3

WCF サービスが例外をスローしています。例外が何であるかを見つけることができません。

このように投げます

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.

web.config

<system.serviceModel>
<services>
  <service name="ServiceName" behaviorConfiguration="debug" />
</services>
<bindings>
  <basicHttpBinding>
    <binding name="BasicHttpBinding_ITwoWayAsync" />
  </basicHttpBinding>
</bindings>
<client>
  <endpoint address="http://company.com/CustCommPreferences.svc" 
            binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ITwoWayAsync" 
            contract="OptInOutServices.CustCommPreferences" name="BasicHttpBinding_ITwoWayAsync" />
</client>
<behaviors>
  <serviceBehaviors>
    <behavior name="debug">
      <serviceDebug includeExceptionDetailInFaults="true" />
      <serviceMetadata httpGetEnabled="true" />
    </behavior>
  </serviceBehaviors>
</behaviors>

ServiceDebugも追加したようですが、それでも内部例外またはスタックトレースを見つけることができません

catch (FaultException ex)
 {
    string msg = "FaultException: " + ex.Message;
    MessageFault fault = ex.CreateMessageFault();
    if (fault.HasDetail == true)
    {
       System.Xml.XmlReader reader = fault.GetReaderAtDetailContents();
       if (reader.Name == "ExceptionDetail")
       {
          ExceptionDetail detail = fault.GetDetail<ExceptionDetail>();
          msg += "\n\nStack Trace: " + detail.StackTrace;
       }
    }
    return View("Error");

   }
4

0 に答える 0