How to configure IIS Express to debug an application in a subdirectory?

前端 未结 1 1365
野的像风
野的像风 2021-02-02 10:46

My web application is typically located in a subdirectory of the root in IIS. Suppose the subdirectory is \"app\"

When I try to debug it in Visual Studio, the path is a

相关标签:
1条回答
  • 2021-02-02 11:04

    I found the answer here: https://stackoverflow.com/a/4733387/88409 Different question, but same answer.

    Basically, one must create a child application, not just a child virtual directory.

    <site name="app" id="5">
        <application path="/" applicationPool="Clr4IntegratedAppPool">
            <virtualDirectory path="/" physicalPath="C:\Users\username\Desktop\wwwroot" />
        </application>
        <application path="/app" applicationPool="Clr4IntegratedAppPool">
          <virtualDirectory path="/" physicalPath="C:\Users\username\Desktop\wwwroot\app" />
        </application>
        <bindings>
            <binding protocol="http" bindingInformation="*:3056:localhost" />
        </bindings>
    </site>
    

    It seems to require both application entries (i.e. it requires a root application (even if it's physically an empty dummy directory) as well as the child application). If I omit the first application entry at the root, then it gets error 500.19 "The requested page cannot be accessed because the related configuration data for the page is invalid." With both application entries, however, it works without any issues.

    As far as I can tell, there is no way to produce the above settings in Visual Studio, so it must be edited manually in application.config. These settings are therefore completely disassociated with the web application project files themselves, which isn't good, IMO.

    0 讨论(0)
提交回复
热议问题