Silverlight WCF Error
If i leave my silverlight application for 10 minutes or so then call a soap method i get the following stack trace:
{System.ServiceModel.CommunicationException: The remote server returned an error: NotFound. ---> System.Net.WebException: The remote server returned an error: NotFound. ---> System.Net.WebException: The remote server returned an error: NotFound. at System.Net.Browser.ClientHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult) at System.Net.Browser.ClientHttpWebRequest.<>c_DisplayClass5.b_4(Object sendState) at System.Net.Browser.AsyncHelper.<>c_DisplayClass2.b_0(Object sendState) --- End of inner exception stack trace --- at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state) at System.Net.Browser.ClientHttpWebRequest.EndGetResponse(IAsyncResult asyncResult) at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result) --- End of inner exception stack trace --- at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result) at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result) at System.ServiceModel.ClientBase
1.ChannelBase
1.EndInvoke(String methodName, Object[] args, IAsyncResult result) at BlueForums.Blue.BlueClient.BlueClientChannel.EndThreadViewIncrement(IAsyncResult result) at BlueForums.Blue.BlueClient.BlueForums.Blue.IBlue.EndThreadViewIncrement(IAsyncResult result) at BlueForums.Blue.BlueClient.OnEndThreadViewIncrement(IAsyncResult result) at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result)}
I've tried attaching my own service behavior to catch the messages and it looks like silverlight it 开发者_如何学Cactually calling the server at all.
any one got any ideas?
Unfortunately, because of Silverlight sandboxing you will get a NotFound error for ANY error that occurs w.r.t your web service. So, if you want to know what the error really is you will have to turn on web service tracing.
I found fiddler to be of good help, learn how to use it, it saves you a lot of time
I have had this problem before, it seems to only occur with IE.
If the service has to timeout, drop connection, recycle (IIS recycles the service when it is not being accessed), or just lose connectivity then IE will no longer try to contact the WCF service, even if you restart the service.
Recently i started using IE9 RC, and this behavior seems to have been fixed. Anyway if the silverlight app ever tries to contact the server, and it is unavailable for what ever reason, then every call from that point on will fail, not only fail, but IE wont even try to contact your service.
Hence why logging in WCF wont show a call at all, in firefox, use firebug, and you will see the silverlight app trying to make the call after your 10 minutes or so.
Try it out.
精彩评论