asp 默认文档在 IIS7 上不起作用
我在 .NET 4.0 应用程序中有一个经典的 asp 应用程序。我已将默认文档设置为 login.asp,但它不会自动重定向到它。整个应用程序运行良好,如果我浏览到它,甚至可以正确显示 login.asp。
web.config 中的默认文档部分如下:
<defaultDocument>
<files>
<clear />
<add value="login.asp" />
<add value="index.html" />
<add value="default.aspx" />
<add value="Default.htm" />
<add value="Default.asp" />
<add value="index.htm" />
<add value="iisstart.htm" />
</files>
</defaultDocument>
我已经查看了该网站上的其他类似问题,但没有太大帮助。
I have a classic asp application inside a .NET 4.0 application. I have set the default document to login.asp, but it does not automatically redirect to it. The entire application functions fine though and even displays the login.asp correctly if I browse to it.
The default document section in web.config is as below:
<defaultDocument>
<files>
<clear />
<add value="login.asp" />
<add value="index.html" />
<add value="default.aspx" />
<add value="Default.htm" />
<add value="Default.asp" />
<add value="index.htm" />
<add value="iisstart.htm" />
</files>
</defaultDocument>
I have looked at other similar questions on this site but were not of much help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我最终发现问题是因为使用 .NET Framework 4.0 将 asp 应用程序分配到经典模式的应用程序池。
一旦我将应用程序池更改为使用 .NET Framework 2.0(在经典模式下使用托管管道),默认文档也开始工作!
I finally found the issue was because the asp application was assigned to an app pool in classic mode using .NET Framework 4.0.
Once I changed the app pool to use .NET Framework 2.0 (with managed pipeline in classic mode), the default document started to work too!
确保您具有读/写功能为默认文档启用功能委托:
DefaultDocument 不会重定向到该文件(即 URL 未更改)。它的作用类似于
Server.Transfer
函数 - 当根 URL (http://sitename/) 被请求。可能您的login.asp 已执行,但它包含将登录用户重定向到不同页面或向他们显示不同内容的指令。确保响应未被缓存。清除缓存和 cookie,然后重试。
Make sure you have Read/Write Feature Delegation enabled for Default Document:
DefaultDocument does not redirect to the file (i.e. URL is not changed). It acts similar to
Server.Transfer
function — executes the file when root URL (http://sitename/) is requested. Probably, your login.asp executed but it has instructions to redirect logged-in users to a different page, or display the different content to them.Make sure the response is not cached. Clear cache and cookies and try again.
我今天在将一个全新的 ASP.NET 站点部署到 Azure 时遇到了这个问题。我尝试搞乱 IIS 并包含我的 web.config
结果发现我的问题是 File >新建项目向导默认使用 .NET 4.5.2,但 Azure 尚未完全支持。我使用 .NET 4.5 作为目标重新编译,现在一切正常!
I had this problem today with a brand new asp.net site deployed to Azure. I tried messing with IIS and my web.config included
Turns out my problem was that the File > New Project wizard uses .NET 4.5.2 by default, and that isn't fully supported yet in Azure. I recompiled using .NET 4.5 as the target and everything works now!