Silverlight and WCF: NotFound error!
I have WCF method like so:
public string GetSomething(MyObject obj)
{
return "Something";
}
When I call this from my silverlight app I get an error:
System.Net.WebException: The remote server returned an error: NotFound.....I call the method from my silverlight app like so:
mProxy.GetSomethingAsync(new MyObject());
Now, when I call the method like this it works fine:
mProxy.GetSomethingAsync(null);
So there seems to be some problem with passing in a complex object.
Note that I return this MyObject from other method and it works fine so it's not a serializable issue. I also changed the maxBufferSize and maxReceivedMessageSize to the max value so it's not that, and i pass in an e开发者_Go百科mpty object anyway so it shouldn't be a size issue. And MyObject only contains simple datatypes.
Has anyone any suggestions?
That "Not Found" error is perhaps the single most annoying feature of Silverlight WCF access.
You may want to look into the Service Trace Viewer Tool (here). It's not always helpful (I've run into lots of problems that it wasn't able to help with), but about 10-20% of the time, it'll point me in the right direction.
You may also want to try adding the SilverlightFaultBehavior to your service. It can turn at least some of those "Not Found" error messages into real faults.
I have used the WcfTestClient.exe to debug my WCF services. It gives a much more user friendly error message. If you want to set up Silverlight to receieve WCF faults, I found this page on Data Performance and Fault Strategies in Silverlight 3 to be helpful.
(http://msdn.microsoft.com/en-us/magazine/ee294456.aspx)
精彩评论