Error Handling in Web Services

Written by Adrian Yong


Hands
Adrian Yong
09 July 2018

In .Net programming with c# or vb.net, we have the throw exception feature. This feature allow the error message to ooze out of each sub function until to the highest calling function.

This however works very different in web service during production mode. What you experienced during debug mode will not happen in released mode. The error from the web service will not be inherited by the calling function.


This is because in released mode or production mode the web service is defaulted to hide errors from the remote calling code. Refer to the web.config debug=false

Hence you must always return the result either by reference, data contract or return variable.

Please implement or else you will get errors like Object Reference Not Found, and a lot of sighing faces.


Author(s) Shoutout

Written by Adrian Yong

Hi everyone, if you have any question, feel free to message me. If you like this article or would like me to extend more on the subject you can email me. Feedback is always appreciated. I will write more. If I get a two thumbs up. =)

License

This article, along with any associated source code and files, is licensed under The Microsoft Public License (Ms-PL).