Service Debug Behavior

Published by Jayaraj on

Occasionally we may be coming across this error and it can be very frustrating to pinpoint what the actual problem is. Debugging in Visual Studio does not always give helpful information either.

Remote Server Error – Debugging Tips:

Just a simple fix on web.config file reveal the Service error.



Alter your web.config file where your WCF service behavior is defined to include exception detail in faults. This will allow us to see the information we need when the WCF service fails. Visual Studio should give much more helpful exceptions when this is enabled.

ServiceDebug is the configuration element that allows changing the service debug behavior properties.This allows the service to return any exception that is thrown by the application code even if the exception is not declared using the FaultContractAttribute. It is done by setting includeExceptionDetailInFaults to true. This setting is useful when debugging cases where the server is throwing an unexpected exception.

The serviceDebug also allows a user to enable or disable the help page. Each service can optionally expose a help page that contains information about the service including the endpoint to get WSDL for the service. This can be enabled by setting httpHelpPageEnabled to true. This enables the help page to be returned to a GET request to the base address of the service. You can change this address by setting another attribute httpHelpPageUrl. You can make this secure by using HTTPS instead of HTTP. This can be done by setting httpsHelpPageEnabled and httpsHelpPageUrl.

Note: If you are still having problems, download, install, and run Fiddler. Fiddler is an HTTP debugging proxy which logs all HTTP traffic between you and the sites you are viewing. Analyze the traffic/requests to see if anything is abnormal. Run your application and attempt to connect/consume your broke WCF service function. You should be able to see the failed request in Fiddler. Once the request that failed is found, inspect the request to view the exception detail message.

 

Categories: CoderDotNet

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.