Different Default Document for IIS Sub Application

只谈情不闲聊 提交于 2019-12-04 05:22:28

问题


I have an IIS website running an ASP.NET site but it has multiple applications running under it (a virtual directory with separate app pools basically).

Well - I need two separate applications which point to the same root folder director but I want the apps to have separate default documents. The reason is because this is how it is configured in production and this is on my development box.

The problem is that IIS keeps giving me the SAME default document for both apps (which are separate virtual paths and separate app pools just same physical location). How can I overcome this or can I not in IIS7?

I am going to be re-writing the whole thing and it will not be done this way in the furture...but until then I need to fix some bugs and want a local dev environment. Help!


回答1:


In order to accomplish this and preserve the setup implemented in our sites I needed to add a location tag around the System.WebServer element in the root site web.config and specify the default document in there as follows where the path is the VirtualDirectory/Application name:

<location path="VirtualDirectoryName">
    <system.webServer>
        <defaultDocument>
            <files>
                <clear />
                <add value="Document.asp" />
            </files>
        </defaultDocument>
    </system.webServer>
</location>
<location path="VirtualDirectoryName2">
    <system.webServer>
        <defaultDocument>
            <files>
                <clear />
                <add value="AnotherDocument.asp" />
            </files>
        </defaultDocument>
    </system.webServer>
</location>


来源:https://stackoverflow.com/questions/10045625/different-default-document-for-iis-sub-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!