IIS Express with Website Project, how to use inside virtual directory?

佐手、 提交于 2019-12-05 23:19:50

I'm seeing similar problems with IIS Express with web applications. From what I'm seeing, IIS Express actually allows you to define a folder in the 'Project Url' field, but then when launching it generates 2 websites, one with the folder and another for the root application. Problem with this is that it is using the same folder for both which brings web.config inheritance issues.

My solution was to go edit the hosting file and change the physicalPath for the root virtual directory to an empty folder in my system

For example:

<site name="MySite1" id="1">
    <application path="/" applicationPool="Clr4IntegratedAppPool">
        <virtualDirectory path="/" physicalPath="C:\VisualStudioProjects\2010\MySite1\MySite1" />
    </application>
    <application path="/ssd">
        <virtualDirectory path="/" physicalPath="C:\VisualStudioProjects\2010\MySite1\MySite1" />
    </application>
    <bindings>
        <binding protocol="http" bindingInformation="*:59473:localhost" />
        <binding protocol="https" bindingInformation="*:44302:localhost" />
    </bindings>
</site>

To this:

<site name="MySite1" id="1">
    <application path="/" applicationPool="Clr4IntegratedAppPool">
        <virtualDirectory path="/" physicalPath="C:\TEMP\New folder" />
    </application>
    <application path="/ssd">
        <virtualDirectory path="/" physicalPath="C:\VisualStudioProjects\2010\MySite1\MySite1" />
    </application>
    <bindings>
        <binding protocol="http" bindingInformation="*:59473:localhost" />
        <binding protocol="https" bindingInformation="*:44302:localhost" />
    </bindings>
</site>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!