Wednesday, September 29, 2010

How to allow wcf client to get WCF service exception details

There are two ways to allow client to get the wcf exption details

IncludeExceptionDetailInFaults

one is by adding the "includeExceptionDetailInFaults" in serviceDebug tag

< behaviors >
< serviceBehaviors >
< behavior name="WCFSampleServiceBehaviors" >
< serviceMetadata httpGetEnabled="true" / >
< !-- The tag below allow to get the exception details from client -- >
< serviceDebug includeExceptionDetailInFaults="true"/ >

< serviceCredentials >
< userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="WcfService1.CustomUserNameValidator,WcfService1"/ >
< /serviceCredentials >
< /behavior >
< behavior name="ServiceBehavior" >
< serviceSecurityAudit auditLogLocation="Application" serviceAuthorizationAuditLevel="SuccessOrFailure"
messageAuthenticationAuditLevel="SuccessOrFailure" / >
< /behavior >
< /serviceBehaviors >
< /behaviors >

Second option is adding service behavior "IncludeExceptionDetailInFaults=true"
[ServiceBehavior(IncludeExceptionDetailInFaults = true)]
public class WCFSampleService : IWCFSampleService
{

}

No comments:

ETG Consultancy

Web Designing Development Analysis & Promotion
Asp.Net 2.0 SQL WWF WCF SEO Marketing Ajax JQuery NHibernate MVC