次の方法で共有


WCF IncludeExceptionDetailInFaults property

A short tip to discover more information when debugging exceptions.

When using WCF Adapter in BizTalk or WCF as a Web Service you may need to troubleshoot exceptions like this one:

Error: 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.System.Exception {System.ServiceModel.FaultException}

IncludeExceptionDetailInFaults property is used to set a value that specifies whether to include Managed exception information in the detail of SOAP faults. This is returned to the client for debugging purposes.

The default is false

<configuration>

    <system.serviceModel>

      <services>

        <service

          name="Microsoft.WCF.Documentation.SampleService"

          behaviorConfiguration="metadataAndDebug">

          <host>

            <baseAddresses>

              <add baseAddress="https://localhost:8080/SampleService" />

            </baseAddresses>

          </host>

          <endpoint

            address=""

            binding="wsHttpBinding"

            contract="Microsoft.WCF.Documentation.ISampleService"

        />

          <endpoint

             address="mex"

             binding="mexHttpBinding"

             contract="IMetadataExchange"

        />

        </service>

      </services>

      <behaviors>

        <serviceBehaviors>

          <behavior name="metadataAndDebug">

            <serviceMetadata

              httpGetEnabled="true"

              httpGetUrl=""

          />

            <serviceDebug

              httpHelpPageEnabled="true"

              includeExceptionDetailInFaults="true" <--- Property="true"

          />

          </behavior>

        </serviceBehaviors>

      </behaviors>

    </system.serviceModel>

  </configuration>

 

In any case a SOAP fault occurs, detailed information will be returned, not only a simple message.