2011-07-26 118 views
5

我有一個Silverlight 4應用程序與運行IIS 7.5的服務器進行通信,該服務器託管了許多我自己的WCF服務。該應用程序在99%的時間內運行愉快,但用戶報告說,應用程序一天會凍結幾次,或者在應用程序的各個位置生成錯誤消息。Silverlight客戶端和WCF服務之間的間歇性通信問題

我打開WCF的跟蹤,並出現以下錯誤:

<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> 

我然後跑提琴手在用戶的機器上,發現了以下錯誤正在發生:

HTTP/1.1 504 Fiddler - Receive Failure 
Content-Type: text/html; charset=UTF-8 
Connection: close 
Timestamp: 18:24:21.941 

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

從一些研究它看起來就像客戶端和服務器之間存在一些通信問題一樣。該服務器是一個虛擬專用服務器,我從來沒有遇到過任何麻煩,從查看日誌,它永遠不會超出處理器/內存明智。

我的問題是:1。 有什麼我能做的來跟蹤更詳細情況發生或任何IIS或服務器相關的我可以調整,以避免這個錯誤 2.在我的Silverlight應用程序是有一些方法我可以等待的時間(例如30秒)的特定量,如果沒有響應已收到取消當前的請求,然後再試一次

+0

你檢查,如果你的服務方法拋出異常? – Jehof

+0

Jehof - 服務方法不會拋出異常。錯誤發生後,您可以進行完全相同的服務方法調用,並且它將起作用。 –

+0

你檢查了服務器的事件日誌嗎? – Jehof

回答

相關問題