Part 15 Exception handling in WCF

preview_player
Показать описание
Link for code samples used in the demo

Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help.

Link for all dot net and sql server video tutorial playlists

When an exception occurs in a WCF service, the service serializes the exception into a SOAP fault, and then sends the SOAP fault to the client.

By default unhandled exception details are not included in SOAP faults that are propagated to client applications for security reasons. Instead a generic SOAP fault is returned to the client.

For debugging purpose, if you want to include exception details in SOAP faults, enable IncludeExceptionDetailInFaults setting. This can be done in 2 ways as shown below.
1. In the config file using service behavior configuration
[behaviors]
[serviceBehaviors]
[behavior name="inculdeExceptionDetails"]
[serviceDebug includeExceptionDetailInFaults="true"/]
[/behavior]
[/serviceBehaviors]
[/behaviors]

2. In code using ServiceBehavior attribute
[ServiceBehavior(IncludeExceptionDetailInFaults=true)]
public class CalculatorService : ICalculatorService
{
public int Divide(int Numerator, int Denominator)
{
return Numerator / Denominator;
}
}

Frequently asked WCF interview questions
What happens when an exception occurs in a WCF service?
OR
What is a SOAP fault?
OR
How are WCF service exceptions reported to client applications?
Рекомендации по теме
Комментарии
Автор

Very well explained in a span of just 10 min time!

SamirBehara
Автор

You are amazing I want to send you some money for this valuable information

chandrunagrani
Автор

You have done very GREAT WORK sir, really these videos are very helpful ...its awesome way of upload the next video sir....Thanks for everything what you have

worldisone
Автор

These are really good and informative stuffs.Please carry it on.
regards

Автор

Sir your video is very helpful to me to go ahead.
Thanks a lot sir, waiting for next video.

pankajprasad
Автор

hello Venkat, what do you think of starting a course on WPF - XAML?
thank you for everything you do for us.

masterblaster
Автор

Thanks for this demo. Can i have my own (log)code by a unhandled exception in my csv-service? I wan't to use log4net in a wcf-service hosted in IIS.

marcpulles
Автор

when i tried to divide by 0 its shows the exception in wcfservice host where iam use divide operation when i stop the wcfservice .it shows me the error like "An existing connection was forcibly closed by the remote host" in the browser.because of this i cant catch the soap faults

hazarathbabu
Автор

I think it doesn't work in WCF REST-service. I am searching for clear tutorial how to handle errors in WCF RESTful services...

ellie
Автор

I did not add this <serviceDebug not i did it programatically still getting the correct divide by zero error error on yellow screen ?

marktabor
Автор

sir where is video on advantages of using interfaces

kiranpedamkar
Автор

sir plz upload the next, , we are wating for it from six days, it never happend plz, plz

manishkumar-whnw
Автор

sir can u made videos on collection in asp.net example

sachinkaushik
Автор

Please make videos on Collections like IEnumerable and IComparable they are widely used and are very confusing.
regards