开发者

Intermittent communication problems between Silverlight client and WCF service

开发者 https://www.devze.com 2023-03-23 10:59 出处:网络
I have a Silverlight 4 application that communicates with a server running IIS 7.5 that hosts a number of my own WCF services.The application runs happily 99% of the time but users reports that a few

I have a Silverlight 4 application that communicates with a server running IIS 7.5 that hosts a number of my own WCF services. The application runs happily 99% of the time but users reports that a few times a day the application will freeze or error messages will be generated at various points in the application.

I turned on WCF tracing and the following errors occur:

<Exception>
  <ExceptionType>System.ServiceModel.ProtocolException, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>
  <Message>The number of bytes available is inconsistent with the HTTP Content-Length header.  There may have been a network error or the client may be sending invalid requests.        </Message>
  <StackTrace>
    at System.ServiceModel.Channels.HttpInput.ReadBufferedMessage(Stream inputStream)
    at System.ServiceModel.Channels.HttpInput.ParseIncomingMessage(Exception&amp; requestException)
    at System.ServiceModel.Channels.HttpChannelListener.HttpContextReceived(HttpRequestContext context, Action callback)
    at System.ServiceModel.Activation.HostedHttpTransportManager.HttpContextReceived(HostedHttpRequestAsyncResult result)
    at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest()
    at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest()
    at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.OnBeginRequest(Object state)
    at System.Runtime.IOThreadScheduler.ScheduledOverlapped.IOCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
    at System.Runtime.Fx.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped)
    at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
  </StackTrace>
</Exception>

I then ran Fiddler on a user's machine and found the following errors were occurring:

HTTP/1.1 504 Fiddler - Receive Failure
Content-Type: text/html; charset=UTF-8
Connection: close
Timest开发者_Go百科amp: 18:24:21.941

ReadResponse() failed: The server did not return a response for this request.

From some research it looks like there is some communication problem between the client and the server. The server is a Virtual Private server which I have never had any trouble with and from looking at the logs it is never maxed out processor/memory wise.

My questions are: 1. Is there anything I can do to track what is happening in more detail or anything IIS or server related I can adjust to avoid this error 2. In my Silverlight application is there some way I can wait a specific amount of time (e.g. 30 seconds) and if no response has been recieved cancel the current request and try again


A similar question is solved in the following webpage: Error at WCF Service The number of bytes available is inconsistent with the HTTP Content-Length header

0

精彩评论

暂无评论...
验证码 换一张
取 消