When an exception occur in WCF service, the service serializes the exception into a SOAP fault, and then sends the fault to client.
By default unhandled exception details are not included in SOAP faults due to security reasons so client is unable to know the actual reason of exception.
If we want to include exception details in SOAP faults we have to enable IncludeExceptionDetailInFaultSetting. this can be done by one of the following ways.
1- In the config file using service behaviour configuration
<behaviors>
<serviceBehaviors>
<behavior name="mexBehaviour">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
2- in code using ServiceBehaviour attribute
[ServiceBehavior(IncludeExceptionDetailInFaults=true)]
Related Post :
Different-option-of-hosting-wcf-service
Binding-in-wcf-choosing-right-wcf
Exchanging-metadata-in-wcf
Some-interesting-facts-about-data-contract
Knowntype-attribute-in-wcf
Associating-knowntype-in-wcf
Message-contract-in-wcf
Exception-handling-in-wcf
Exception Handling in WCF - SOAP Fault in WCF
Exception Handling in WCF - Unhandled Exception in WCF
Exception Handling in WCF - Creating and Throwing Strongly Typed SOAP Fault
By default unhandled exception details are not included in SOAP faults due to security reasons so client is unable to know the actual reason of exception.
If we want to include exception details in SOAP faults we have to enable IncludeExceptionDetailInFaultSetting. this can be done by one of the following ways.
1- In the config file using service behaviour configuration
<behaviors>
<serviceBehaviors>
<behavior name="mexBehaviour">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
2- in code using ServiceBehaviour attribute
[ServiceBehavior(IncludeExceptionDetailInFaults=true)]
Related Post :
Different-option-of-hosting-wcf-service
Binding-in-wcf-choosing-right-wcf
Exchanging-metadata-in-wcf
Some-interesting-facts-about-data-contract
Knowntype-attribute-in-wcf
Associating-knowntype-in-wcf
Message-contract-in-wcf
Exception-handling-in-wcf
Exception Handling in WCF - SOAP Fault in WCF
Exception Handling in WCF - Unhandled Exception in WCF
Exception Handling in WCF - Creating and Throwing Strongly Typed SOAP Fault
No comments:
Post a Comment