17

wcf Web サービスからデータを取得していますが、データが 20 万レコードを超えると、次のような例外が発生します。

System.ServiceModel.CommunicationException: The underlying connection was closed: A connection that was expected to be kept alive was closed by the server. ---> System.Net.WebException: The underlying connection was closed: A connection that was expected to be kept alive was closed by the server. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
--- End of inner exception stack trace ---
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.PooledStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.Connection.SyncRead(HttpWebRequest request, Boolean userRetrievedStream, Boolean probeRead)
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.GetResponse()
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
--- End of inner exception stack trace ---

Server stack trace: 
at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason)
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

私のweb.configは次のようになります:

<basicHttpBinding>
  <binding name="BasicHttpBinding_IService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
             maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
             allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
             messageEncoding="Text" textEncoding="utf-8" transferMode="StreamedResponse" useDefaultWebProxy="true">
    <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647"
                  maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
    <security mode="None">
      <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
      <message clientCredentialType="UserName" algorithmSuite="Default" />
    </security>
  </binding>
  <binding maxReceivedMessageSize="2147483647" allowCookies="true">
    <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
  </binding>
</basicHttpBinding>

Web サービスが DB からデータを取得していることは確かです。しかし、通話を開始した場所から自分の Web に転送できません。助けてくれてありがとう。

4

5 に答える 5

2

クライアントの basicHttpBinding をサーバー バインディングと同じにします。これは、サーバーとクライアントのバインドではなく、1 つのバインドのみを変更するという非常に一般的なエラーです。

それが機能しない場合は、wcf トレースを有効にすることができます: wcf トレース

これにより、根底にある問題が何であるかについて、より多くの洞察が得られます。

于 2013-10-22T14:15:44.587 に答える
0

オブジェクト グラフにループがありました。これはおそらくあなたの問題ではないことはわかっていますが、他の誰かが同じ問題を抱えている場合に備えて、ここに追加しています. includeExceptionDetailInFaults を有効にしましたが、どのクライアント (アプリケーションまたは WCF テスト クライアント) でもエラーが発生しませんでした。幸いなことに、サーバーログに表示されたので、その方法で見つけることができました.

親 -> 子と子 -> 双方向ナビゲーションの親がありましたが、そのリンクを解除して、代わりに親 -> 子を使用する必要があり、子は親を検索するための ID を持っていたため、エラーはなくなりました。

これが誰かを助けることを願っています!

于 2014-03-10T01:08:55.880 に答える