Welcome to Shaun Luttin's public notebook. It contains rough, practical notes. The guiding idea is that, despite what marketing tells us, there are no experts at anything. Sharing our half-baked ideas helps everyone. We're all just muddling thru. Find out more about our work at bigfont.ca.

How to handle the virtual directory when developing locally?

Tags: orchard-cms

Answer

Don't use a virtual directory. Remove it from the project’s properties in VS or set up in full IIS as a Website (not Virtual Directory). Credit to Steve Taylor.

Setup a new Website in IIS.

IIS > Connections > Sites > Add Website > Fill in the fields.

image

image

image

Then, Configure Orchard in Visual Studio to use that Website.

Orchard.Web > Properties > Web > Fill in the fields.

image

Original Question

The problem is, when we upload an image from the live site, the img.src looks like src="/Media/Default/SomeFolder/someimage.jpg", whereas when we upload it from dev site, it looks like src="/Orchard.Web/Media/Default/SomeFolder/someimage.jpg", where Orchard.Web is the virtual directory.

This makes it a pain to use the same images on the live and dev sites, because we must add/remove the virtual directory to/from all the img.src paths.

Further Questions:

  1. Is this by design or a bug?
  2. If it is by design, what is the motivation, and is there a workaround?
  3. If it is a bug, then can I sign up to fix it?

See also

https://orchard.codeplex.com/discussions/550898