gpt4 book ai didi

asp.net - IIS 子应用程序的不同默认文档

转载 作者:行者123 更新时间:2023-12-04 05:51:00 24 4
gpt4 key购买 nike

我有一个运行 ASP.NET 站点的 IIS 网站,但它有多个应用程序在其下运行(基本上是一个具有单独应用程序池的虚拟目录)。

好吧 - 我需要两个单独的应用程序,它们指向同一个根文件夹目录,但我希望这些应用程序具有单独的默认文档。原因是因为这是它在生产中的配置方式,这在我的开发箱上。

问题是 IIS 一直为我提供两个应用程序的相同默认文档(它们是单独的虚拟路径和单独的应用程序池,只是相同的物理位置)。我怎样才能克服这个问题,或者我不能在 IIS7 中?

我将重新编写整个内容,并且将来不会以这种方式完成......但在那之前我需要修复一些错误并想要一个本地开发环境。帮助!

最佳答案

为了实现这一点并保留在我们的站点中实现的设置,我需要在根站点 web.config 中的 System.WebServer 元素周围添加一个位置标记,并在其中指定默认文档,如下所示,其中路径是 VirtualDirectory/Application姓名:

<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>

关于asp.net - IIS 子应用程序的不同默认文档,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10045625/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com