includeExceptionDetailInFaults无法正常工作 [英] includeExceptionDetailInFaults not working

查看:78
本文介绍了includeExceptionDetailInFaults无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

includeExceptionDetailInFaults not working

I have an AJAX-Enabled WCF service.  I think I'm passing a parameter incorrectly to one of the operations and the WCF service is returning the following response:

{"ExceptionDetail":null,"ExceptionType":null,"Message":"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 <serviceDebug> 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.","StackTrace":null}

I googled this and I'm supposed to include the following node for the service behavior:

<serviceDebug includeExceptionDetailInFaults="true"/>

I've done this but I'm still getting the same above error response from the WCF service.  Here is the full service configuration from my Web.config.  What do I need to do to fix this so I can start receiving valid error messages?

  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name="DataServiceBehaviors">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="DataServiceAspNetAjaxBehavior">
          <enableWebScript/>
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
    <services>
      <service name="DataService">
        <endpoint address="" behaviorConfiguration="DataServiceAspNetAjaxBehavior" binding="webHttpBinding" contract="DataService"/>
      </service>
    </services>
  </system.serviceModel>

推荐答案

尝试设置服务BehaviorConfiguration,以使其生效...

Try setting the service BehaviorConfiguration so it will have effect...

<service name="DataService" behaviorConfiguration="DataServiceBehaviors" >
  <endpoint address="" behaviorConfiguration="DataServiceAspNetAjaxBehavior" binding="webHttpBinding" contract="DataService"/>
</service>


这篇关于includeExceptionDetailInFaults无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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