asp.net - Trace.axd 返回 YSOD 不是自定义错误

标签 asp.net iis web-config stack-trace ysod

这简直快把我逼疯了……我在 IIS7 上有一个网站,运行 ASP.Net 3.5。跟踪已关闭,并且我配置了自定义错误,但是当我访问 www.mysite.com/trace.axd 时,我收到标准 ASP.Net YSOD,而不是自定义错误页面。返回的状态是 500,但是更奇怪的是,当使用 Cassini 或 Dev Server 时,状态是 403。

所以我的问题是如何在 Live Box 上返回自定义错误页面而不是标准 ASP.Net YSOD?

自定义错误配置:

<customErrors mode="RemoteOnly" defaultRedirect="~/Error.aspx" redirectMode="ResponseRewrite">
<error statusCode="404" path="~/404.aspx" redirect="~/404.aspx" responseMode="ExecuteURL" /></customErrors>

跟踪设置:

<tracing>
            <traceFailedRequests>
                <add path="*.aspx">
                    <traceAreas>
                        <add provider="ASP" verbosity="Verbose" />
                        <add provider="ASPNET" areas="Infrastructure,Module,Page,AppServices" verbosity="Verbose" />
                        <add provider="ISAPI Extension" verbosity="Verbose" />
                        <add provider="WWW Server" areas="Authentication,Security,Filter,StaticFile,CGI,Compression,Cache,RequestNotifications,Module" verbosity="Verbose" />
                    </traceAreas>
                    <failureDefinitions timeTaken="00:00:00" statusCodes="500" />
                </add>
            </traceFailedRequests>
        </tracing>

非常感谢您提供任何帮助,如果您需要其他任何帮助,请告诉我:)

最佳答案

删除 Web.config 文件中的跟踪 HTTP 处理程序:

  <system.webServer>
    <!-- remove TraceHandler-Integrated - Remove the tracing handlers so that navigating to /trace.axd gives us a 
         404 Not Found instead of 500 Internal Server Error. -->
    <handlers>
      <remove name="TraceHandler-Integrated" />
      <remove name="TraceHandler-Integrated-4.0" />
    </handlers>
  </system.webServer>

导航到/trace.axd 现在会显示 404 Not Found,而不是 500 内部服务器错误。

关于asp.net - Trace.axd 返回 YSOD 不是自定义错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13465808/

相关文章:

c# - 这是我们可以强制 ObjectDataSource 的唯一方法吗?

c# - validateRequest ="false"在 ASP.NET 2.0 中不起作用

c# - 如何在 .NET 程序集中找到相应的 .pdb?

web-services - 404 在现有的 .svc 文件上

windows - IIS w3svc 错误

asp.net - Azure Functions 项目在 Azure Functions 扩展升级后出现 System.ValueTuples 错误

azure - 如何在 Azure 中安装从 GoDaddy 购买的 SSL 证书

c# - 我可以在没有 AzureWebJobsStorage 连接字符串的情况下执行 Azure webjobs 吗?

web-services - 网页引用配置问题

c# - 指定的参数超出了有效值的范围。参数名称 : site