Search code examples
asp.netasp.net-mvcvisual-studioiisiis-express

Visual Studio 2015 Community Version Fails to Create Virtual Directory in IIS Express


I have migrated my test ASP.NET MVC application to Visual Studio 2015. I try to host it in the built-in IIS Express by configuring the project in the following way - enter image description here

The message said that the virtual directory was created successfully.

I will expect an entry being created in section of C:\Users\myadministratorusername\Documents\IISExpress\config\applicationhost.xml like this -

            <site name="WebSite2" id="2">
                <application path="/">
                    <virtualDirectory path="/" physicalPath="C:\Projects\Service

\NTier\GH.Northwind\Clients\GH.Northwind.Web" />
                </application>
                <bindings>
                    <binding protocol="http" 

bindingInformation="*:55566:dev.eastwardit.com" />
                </bindings>
            </site>

However there is nothing there. The file applicationhost.xml has not been updated at all. Where was the successful virtual directory created except for in this file?

I thought I can manually add the virtual directory to the file. I deleted the IISExpress folder and reopen my application in visual studio under administrator account. And then I manually added the above xml codes to the auto recreated applicationhost.xml. When I ran the application, I got this error message - enter image description here

I had set up the virtual directory successfully in this way before. Now it does not work under Visual Studio 2015.

Anyone knows what I have missed or how to trace the problems of this issue. I searched Internet for a solution but have not found one so far.

Thanks,


Solution

  • Found the solution.

    I tried Visual Studio 2012 and WebMatrix. The way I expected is working in both tools.

    However Visual Studio 2015 uses different applicationhost.config. I got help from here. In my case, the virtual directory was created in ~SolutionFolder~/.vs/config/applicationhost.config.