【发布时间】:2013-12-09 08:18:27
【问题描述】:
我用 IIS7 全新安装了 Windows Server 2008。在那里我安装了“Classic ASP”并将调试选项“Send Errors To Browser”更改为True。
1.
我创建了一个包含 2 个文件的目录:
-- C:\inetpub\wwwroot\stadtbibliothek
- index.asp -> <% Response.Write "Hello World" %>
- 500-100.asp -> <% Response.Write "Error" %>
我将目录转换为应用程序并分配了我创建的应用程序池(.net 版本:无托管代码,管道代码:经典)。
然后我从远程客户端 (http://svr-name.domain/stadtbibliothek/) 测试了该页面,然后出现了“Hello World”。
2.
我在 index.asp 文件中添加了一个错误,在“stadtbibliothek”文件夹中添加了一个 web.config 文件(根目录中没有):
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<defaultDocument>
<files>
<add value="index.asp" />
</files>
</defaultDocument>
<httpErrors>
<remove statusCode="500" subStatusCode="100" />
<error statusCode="500" subStatusCode="100" prefixLanguageFilePath="" path="/error.asp" responseMode="ExecuteURL" />
</httpErrors>
</system.webServer>
</configuration>
解决方案:
原来我只需要在路径中包含文件夹名称:
<error statusCode="500" subStatusCode="100" prefixLanguageFilePath="" path="/stadtbibliothek/error.asp" responseMode="ExecuteURL" />
感谢您的建议!
【问题讨论】:
标签: iis-7 asp-classic custom-error-pages