views:

551

answers:

4

It seems that WCF diagnostics is not available in SL. Is it because of limited System.Diagnostics support or something else? Anyway, how do you track client-side WCF issues when server-side diagnostics is not enough?

+1  A: 

I think this article will help.

http://msmvps.com/blogs/theproblemsolver/archive/2009/01/27/returning-exception-information-to-a-silverlight-client-through-wcf.aspx

Rus
+1 because I wasn't aware of that mechanism.
Program.X
That's about error handling, not diagnostics. In my case there is no exception on the server-side (at least in my service method). The .svclog contains no errors although it's broken (TraceViewer says 'unexpected end of file' while opening it). So i'd like to get something more useful than 'Not found' on the client side.
UserControl
+1  A: 

This is how I solved my problem of correctly obtaining exceptions at the Silverlight Client. Similar to Rus' but does not require wrapping of exceptions. Though it does require the version number to be exact in web.config (still working on solving that)

http://stackoverflow.com/questions/1466462/programmatic-configuration-of-exception-sending-in-wcf

Program.X
+1  A: 

If you're getting a 'Not Found' Error the most likely cause is the cross domain access policy. What I use to try diagnose those problems is Fiddler2, and look at the raw traffic.

Graeme Bradbury
Thanks! Tried Fiddler and get only "ReadResponse() failed: The server did not return a response for this request." However, my issue is not cross doamin access as i play with a local project. I suspect a serialization problem 'cause the exception happens from time to time, somehow related to the result set from my DB.
UserControl
A: 

Are you sure that your WCF service is not faulting on the call? If something is going wrong on the server-side the returned message will be of HTTP status code 500. Due to security restrictions, the browser will not pass any non-200 messages back to the silverlight plugin which results in silverlight throwing the classic CommunicationException "The remote server returned an error: NotFound."

There are some pretty well documented work-arounds for using a WCF behavior to change the HTTP status code on the fault from 500 to 200 so silverlight will actually have access to the details of what went wrong. More info here:

http://msdn.microsoft.com/en-us/library/dd470096(VS.95).aspx

http://www.netfxharmonics.com/2009/07/Understanding-WCF-Faults-in-Silverlight-3

Dan Auclair
I'm sure that my method does not throw an exception (the breakpoint on the method's closing brace is hit). Anyway, neither of the links were helpful. The first one broke the service totally and the second one was not working (and i did make sure that HttpStatusCode200Behavior is applied when the host is activated).
UserControl