Thursday, September 30, 2010

 

Getting includeExceptionDetailInFaults to do something

Setting <serviceDebug includeExceptionDetailInFaults="true" /> in a Silverlight ServiceReference's web.config seems to keep the same old "NotFound" details when an exception is thrown when a Silverlight app makes a call to it. Today I found out why; the Browser stack does not capture much in regard to fault details.

Silverlight uses two different stacks; the Client stack and the Browser stack.

Client stack is not the default stack. However, it has better handling of WCF error and status codes. To switch to the Client stack add the line below to your silverlight UserControls constructor:


public MainPage()
{
InitializeComponent();
WebRequest.RegisterPrefix("http://", WebRequestCreator.ClientHttp);
}


After this you'll see everything about the exception that was thrown by the WCF service, From the exception type to the entire call stack.

After you've debugged your WCF service you should switch back to the Browser stack, not only for security reason but that default browser stack handles windows authentication and automatic cookie handling.

Reference:
starts 11:48 minutes into http://channel9.msdn.com/Shows/SilverlightTV/Silverlight-TV-46-Whats-Wrong-with-my-WCF-Service

Labels: , , ,


Comments: Post a Comment

Subscribe to Post Comments [Atom]





<< Home

This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]