Search code examples
visual-studio-2015iis-expressvirtual-directory

Visual Studio 2015 project not getting virtual directory from application.host


I have been using VS2013, but just installed VS2015. The web project (not website) that I had been developing uses a virtual directory which is defined in the application.host config file. It worked fine before when debugging locally via IIS Express. But now that I'm on VS2015, it acts like the virtual host doesn't exist.

Here's what I have in the config file...

        <site name="VMCC" id="1993109772">
            <application path="/" applicationPool="Clr4IntegratedAppPool">
                <virtualDirectory path="/" physicalPath="C:\Users\myuser\Documents\Visual Studio 2013\Projects\VMCC\VMCC" />
            </application>
            <application path="/Photos" applicationPool="Clr2IntegratedAppPool">
                <virtualDirectory path="/" physicalPath="c:\VMCC Photos" />
            </application>              
            <bindings>
                <binding protocol="http" bindingInformation="*:52962:localhost" />
            </bindings>
        </site>

When I load the project as a 'website', it shows the virtual directory there, and it works when debugging. However, I don't want to develop it as a 'website' since I can't publish it. None of my old publish profiles are available when working as a 'website.'

So does VS2015 just not support this or is there some new setting I'm missing?

EDIT 1

Based on this post... Creating virtual directories in IIS express

I changed it to look like this:

        <site name="VMCC" id="1993109772">
            <application path="/" applicationPool="Clr4IntegratedAppPool">
                <virtualDirectory path="/" physicalPath="C:\Users\myuser\Documents\Visual Studio 2013\Projects\VMCC\VMCC" />
                <virtualDirectory path="/Photos" physicalPath="c:\VMCC Photos" />
            </application>
            <bindings>
                <binding protocol="http" bindingInformation="*:52962:localhost" />
            </bindings>
        </site>

But it is still not working when debugging from VS2015.


Solution

  • it might be caused by the wrong config file you edited. VS 2015 uses .vs\config\applicationHost.config in solution folder, not the one in your documents folder.