我有一个干净的 Windows Server 2008 安装,其中安装了 IIS7。我安装了“经典 ASP”并将调试选项“向浏览器发送错误”更改为 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" />
感谢您的建议!