Creating a virtual directory failed with the error

You can opt to install IIS locally and edit a couple of tags on .csproj File. Open you csproj file and go to section <VisualStudio> then find tag <UseIIS>True</UseIIS> it must be set as true, then go to tag: <IISUrl> and set up with the URL address where the application will be hosted for testing:

<VisualStudio>
      <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
        <WebProjectProperties>
          <UseIIS>True</UseIIS>
          <AutoAssignPort>False</AutoAssignPort>
          <DevelopmentServerPort></DevelopmentServerPort>
          <DevelopmentServerVPath>/</DevelopmentServerVPath>
          **<IISUrl>http://localhost/myWebSiteAppSample</IISUrl>**
          <NTLMAuthentication>False</NTLMAuthentication>
          <UseCustomServer>False</UseCustomServer>
          <CustomServerUrl>
          </CustomServerUrl>
          <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
        </WebProjectProperties>
      </FlavorProperties>
    </VisualStudio>

And that is. Now you can load your project normally.


More often than not, at least in my case, this happens is when a *.csproj.user file is in the project directory and has <UseIISExpress>true</UseIISExpress> in it.

Alternatively, as mentioned by Zachary Cutler you can also simply: close Visual Studio, delete the *.csproj.user file and reopen Visual Studio. This will force VS to rebuild the file.


I've already found the solution. I just had to edit C:\Users\Administrator\Documents\IISExpress\config\applicationhost.config file, by adding my site to <sites> node.