none
WCF returning unrelated error messages RRS feed

  • General discussion

  • Below is the error message i get which is totally unrelated to the what was happening in WCF services - there was a error in database call to one of the SP's which is in no way relation to what error message which is being returned by WCF.

    The server did not provide a meaningful reply; this might be caused by a contract mismatch, a premature session shutdown or an internal server error

    It wold be more helpfull if wcf can provide a meaning full messages.

    I am on VS 2010.


    Tuesday, January 27, 2015 8:18 PM

All replies

  • Well, what you need to be doing is logging errors using something like Log4Net on the WCF service side. It means you need to be doing try/catches around code that can throw an exception, catch the excption and log the true error, which is being swallowed by WCF as WCF doesn't throw excpetions over the client/service boundry.

    Your other option is to use request/response objects  where the error exceptions are caught via a try/catch at the highest point in code on the service side to catch the true error message, populate the error message to the response object,  the response object is sent back to the client, and the client checks the response object for possible errors. 

    http://thatextramile.be/blog/2009/11/requestresponse-service-layer-requests-and-responses/

    So the response object comes back with proper response data within the response object with no error messages, or error messages are sent back in the response object.

    Tuesday, January 27, 2015 8:59 PM