Weyl spacetimes and wormholes in D-dimensional Einstein and dilaton gravity