Thursday, July 28, 2011

Silverlight - WCF: NotFound Exception

Hi all.

Today I'll try to cover a problem, which many Silverlight developers are facing, trying to make WCF service calls. So the problem is that there are a lot of cases, when the client will get "NotFound" error, and here are the possible reasons for that.
(Make a note, that I will assume that the service is actually running, and you're calling to correct endpoint).
1. The amount of data being transfered is more than the limits - the service and clients are configured for. Remember, even if you haven't manually configured those values, there are some defaults. So this can be a cause for such an exception. Here is a good link as a start point for this case.
2. When a method returs something, which contains, or itself is an Enum type, and you've overriden the default values of that enum, by giving different values to its members, and there is no value with 0, then you'll have the same. This is because during serialization, if you won't assign any value to those members, which are type of the Enum, they will get default value (they are value type), which is 0 for Enums, and the Serializer will try to serialize the 0 to any of the marked values, which don't contain 0, so you'll end up by a Serialization Exception on service side, which won't be handled on client and will come back as a NotFound error.

Good luck with your development.
Post a Comment