WebFaultException not handled in user code

I use the WCF REST service (4.0) to expose the JSON API .. but not get the job done WebFaultException.

I have the following method:

        if (!int.TryParse(Id, out idValue))
        {
            throw new WebFaultException<string>(string.Format(WebExceptionMessages.NotIntegerAsParameter),
                                                HttpStatusCode.BadRequest);
        }

and when I try to call a service on fiddler, I always get the same error message:

Error when debugged

I have been trying to find a solution for some time ... please help.

+3
source share
1 answer

WebFaultExceptionworking correctly - the error message in Visual Studio just tells you that it is not being processed - this is the expected behavior. The Visual Studio debugger will tell you that it is unhandled since you did not catch the error when trying / catching. See the MSDN related blog for usageWebFaultException .

+1

All Articles