IIS 获取失败请求的完整错误消息

Bet*_*ide 8 windows iis wcf iis-7.5

我设置了 IIS 并为我的网络服务提供服务。不幸的是,如果网络服务抛出异常,我得到的只是一个带有标题失败请求的蓝色框。

我有什么选择才能真正看到哪里出了问题?我更喜欢获取异常消息和堆栈跟踪。

我已经设置了“失败的请求跟踪”,但目录仍然是空的。如果可能,我更愿意直接在浏览器中获取堆栈跟踪。

如果这很重要:我在 Win 7 64 Pro 机器上有一个 IIS 7.5。Web 服务是一个 WCF C# 项目。

小智 7

您会在事件日志中找到错误,但将它们放在浏览器中确实更方便(尤其是在开发过程中)。要做到这一点:在转调试你的web.config。此外,关闭自定义错误或将它们设置为"Remote only".

<configuration>
    <system.web>
        <customErrors mode="Off" />
        <compilation debug="true" />
    </system.web>
</configuration>
Run Code Online (Sandbox Code Playgroud)


Mic*_*elZ 0

在 web.config中的服务行为中尝试以下操作

 <behavior name="Your.Service.Type">
    <serviceMetadata httpGetEnabled="true"/>
    <serviceDebug includeExceptionDetailInFaults="true"/>
 </behavior>
Run Code Online (Sandbox Code Playgroud)