Home > WCF > Unhandled exception in WCF

Unhandled exception in WCF

We will call Business logic layer or DAL through the Web service or WCF if any fault occurs in any layer that uncaught exception will propagate upto service layer, normally at service layer uncaught exception will converted into soap fault exception. Once uncaught exception reaches service layer, it may or may not be exposed to the client, depending upon ‘IncludeExceptionDetailsInFaults’ boolean value which define under the <ServiceBehaviour> section.

By default service won’t share the exception detail with the client since ‘IncludeExceptionDetailsInFaults=False’. This is because if you get any exception in DAL like connection string based exception or any SQL operation error it will directly exposed to client which is not advisable. So when ‘IncludeExceptionDetailsInFaults’ is set to False service general exception information like ‘InternalServiceFault’ will throw to the client, but the exception we received was not very useful.

ServiceDebug

when you want to debug what kind of exception exactly you are getting you can turn on the ‘IncludeExceptionDetailsInFaults’. Once you turn on you can able to
see all kind of exception detail, its stacktrace are also included in the general exception information.

Suppose if you are using ‘wsHttpBinding’ it will use session at that time if you face unhandled exception you can’t use your exception any more, similarly your client
channel also become useless.

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

%d bloggers like this: