404 NotFound strikes back

November 3rd, 2009

I have a Silverlight application consuming a WCF service. And as you may know WCF errors are not serialized on the Silverlight side and all you get is generic NotFound error.

I was experiencing the error only in certain rare cases.
Everything seemed fine in the WCF side, no exceptions were thrown in my service contracts.

I fiddled with the Fiddler but that did not capture anything.

I fixed the issue purely by  divide/conqure method. Turns out I was passing an object with an enum type property, but was never setting that property. The debugger showed that the value of the enum property was the first item in the enum as one would expect.
However, when I explicitly set the property it all started to work!

And then the dreaded 404 came back! The previuosly used debugging techniques showed it’s a different issue and was related to how much data I was returning out. The usual suspects message, buffer, maxarray sizes did not help.

Fiddler was useless again. So I decided to try WCF tracing. I found a post by Yi-Lun Luo http://forums.silverlight.net/forums/p/17733/83940.aspx?PageIndex=3 that helped me do it. I also found using the WCF Config Edit tool usable for that purpose.

Finally, I found something helpfull for debugging 404 errors between Silverlight and WCF!
The trace showed that I was exceeding maxItemsInObjectGraph; a setting I never heard about before.

Again WCF Config Edit tool was helpfull and I upped the max number and no more stupid 404.

On a side note me and my comrad felt the app was snappier after this setting.

Leave a Reply

Comments for this post will be closed on 2 January 2010.