我们正在将 ASP Classic/ASP.NET 应用程序从 IIS 6 迁移到 IIS 7.5。大多数事情在经典模式下运行得很好,但我们在 IIS 7.5 如何处理错误方面遇到了很多问题。我们使用经典的 ASP 页面进行错误报告,我们在此处捕获错误信息,然后重定向到一个页面以显示错误。基于我们的测试 Server.GetLastError
和 Request.ServerVariables("SCRIPT_NAME")
从日志页面访问时,不返回错误详细信息和来源。是否有其他方法可以检索 IIS 7.5 上的错误信息或执行日志记录?
如果这有帮助,我们注意到 IIS 似乎生成了一个全新的请求,然后开始执行我们的错误捕获。
提前致谢。
最佳答案
@smaclell:见 http://dylanbeattie.blogspot.com/2008/12/fun-with-servergetlasterror-in-classic.html为您提供潜在的解决方案。
这是文章中的相关段落:
There was a very similar known bug in Vista which was supposedly fixed in SP1, but it looks like the same fix isn't part of Windows 2008 Server yet. There is a workaround, though - if you set the site's default error property (under IIS settings -> Error Pages -> Edit Feature Settings...) to the custom page, IIS will invoke this page whenever an error is not handled by an explicitly configured status-code handler (so your 404, etc. handlers will still work) - but for some reason, handling the error this way means Server.GetLastError() still works properly.
关于iis-7 - IIS 7.5 经典 ASP 错误处理与 IIS 6 不同,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4197844/