Failed to map the path '/' when setting VirtualDirectory path in applicationhost

541 views Asked by At

I have been attempting to set a Virtual Path for my website in Visual Studio 2013, so that when I debug it uses http://localhost:51196/test1/ instead of just http://localhost:51196/. I have seen from here that this has since been discontinued from Visual Studio 2012. In attempting to resolve this now using IIS Express I have tried editing the relevant section of applicationhost.config and changing the virtualDirectory path="/" to virtualDirectory path="/test1", and it now reads:

<site name="website2" id="2">
   <application path="/" applicationPool="Clr4IntegratedAppPool">
      <virtualDirectory path="/test1" physicalPath="C:\Websites\website2" />
   </application>
   <bindings>
      <binding protocol="http" bindingInformation="*:51196:localhost" />
   </bindings>
</site>

Unfortunately, when I try to debug now I get the following error in Visual Studio 2013:

Failed to map the path '/'

Any ideas as to what I am doing wrong?

1

There are 1 answers

0
Lex Li On

An application must have a virtualDirectory whose path is "/".

So when manually editing the config file, try to always add extra things, such as a new virtualDirectory whose path is "/test". That in most cases avoid such issues.

Of course, you might try out Jexus Manager for IIS Express, which automates such editing,

https://jexus.codeplex.com/releases/view/138373