I am pretty new to WCF in general. What little experience I have comes from using fairly simple .SVC services in ASP.NET web applications.
I tried experimenting with using a WCF Project for the first time, and ran into a major show-stopper.
As I’m sure most are aware, for some strange reason, in a web application in which the customErrors mode is set to On
<customErrors mode = “On” />
services (both .ASMX and .SVC) will not return exception details to the client. Instead, the exception and stack trace are emptied, and the message always reads “There was an error processing the request”, which is not at all helpful.
When services are directly hosted inside the web application itself, it’s easy to work around this restriction by placing the services in a dedicated folder, and setting customErrors to "Off" for that folder.
However, I’m running into this same issue with exceptions not being returned from services that live in a separate WCF project. Thing is, I don’t know how to work around that.
In a nutshell: I need to get my WCF Project services to bubble REAL exceptions to the client – or at least, the original exception message, instead of “There was an error processing the request”.
EDIT: I should probably point out here that the reason I'd like to return exceptions is that I'm often calling these services from the client side via Ajax (jQuery), and would like to format the return message differently if it's a "normal" return (like say, use green text), and then use red text if it's an error. I handle the message formatting in the $.ajax object's error handler, which obviously will only run when the service fails.
I should also point out that everything works fine with customErrors Off:
<customErrors mode = “Off” />
So, I'm thinking maybe there's some configuration property that can be set to stop the ASP.NET runtime from killing my exception when using customErrors.
Here is some related info I found on this: http://bit.ly/9tlmCO