打开IncludeExceptionDetailInFaults(无论是从ServiceBehaviorAttribute或从在< serviceDebug>配置行为)在服务器上 [英] Turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server

查看:751
本文介绍了打开IncludeExceptionDetailInFaults(无论是从ServiceBehaviorAttribute或从在< serviceDebug>配置行为)在服务器上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经可以正常使用WCF服务,而事情已经改变,我不知道是什么。

I have a WCF service that has been working perfectly, and something has changed and I don't know what.

我得到这个异​​常:

System.ServiceModel.FaultException:服务器由于内部错误,无法处理请求。有关错误的详细信息,无论是在IncludeExceptionDetailInFaults(无论是从ServiceBehaviorAttribute或从配置行为)在服务器上,以便将异常信息发送回客户端,或打开跟踪根据在Microsoft .NET Framework 3.0 SDK文档打开并检查服务器跟踪日志。

System.ServiceModel.FaultException: The server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework 3.0 SDK documentation and inspect the server trace logs.

这是令人困惑,因为我运行的.NET 4.0。

This is confusing because I am running .NET 4.0.

我在哪里打开 IncludeExceptionDetailInFaults ?我挣扎着找到它。

Where do I turn on IncludeExceptionDetailInFaults? I'm battling to find it.

推荐答案

定义的行为在你的的.config 文件

<configuration>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name="debug">
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    ...
  </system.serviceModel>
</configuration>

则行为沿着这些线路适用于您的服务:

Then apply the behavior to your service along these lines:

<configuration>
  <system.serviceModel>
    ...
    <services>
      <service name="MyServiceName" behaviorConfiguration="debug" />
    </services>
  </system.serviceModel>
</configuration>

您也可以通过编程设定。见<一href=\"http://stackoverflow.com/questions/2483178/set-includeexceptiondetailinfaults-to-true-in-$c$c-for-wcf\">this问题。

You can also set it programmatically. See this question.

这篇关于打开IncludeExceptionDetailInFaults(无论是从ServiceBehaviorAttribute或从在&lt; serviceDebug&GT;配置行为)在服务器上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆