2

WCF クライアントから「メッセージを処理できませんでした...」というエラーが表示されます。助けてください、それは私を殺しています。

forループを通過してx回の非同期呼び出しを開始するテスト勝利アプリがあります。各非同期呼び出しは、WCF プロキシの独自のインスタンスをインスタンス化し、そのプロキシを使用して WCF サービスを呼び出します。xが約 35 以下であれば問題ありません。x > 40 程度の場合、多くの呼び出しは問題なく完了しますが、少数の呼び出しは次のように返します。

System.ServiceModel.Security.MessageSecurityException: 
  An unsecured or incorrectly secured fault was received from the other party. 
  See the inner FaultException for the fault code and detail. ---> 
  System.ServiceModel.FaultException: The message could not be processed. 
  This is most likely because the action 'http://tempuri.org/IMyService/MakeRequest' 
  is incorrect or because the message contains an invalid or expired 
  security context token or because there is a mismatch between bindings. 
  The security context token would be invalid if the service aborted 
  the channel due to inactivity. To prevent the service from aborting 
  idle sessions prematurely increase the Receive timeout on the 
  service endpoint's binding.
  --- End of inner exception stack trace ---

Server stack trace: 
   at System.ServiceModel.Security.SecuritySessionClientSettings`1.SecurityRequestSessionChannel.ProcessReply(Message reply, TimeSpan timeout, SecurityProtocolCorrelationState correlationState)
   at System.ServiceModel.Security.SecuritySessionClientSettings`1.SecurityRequestSessionChannel.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)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at ...

メッセージセキュリティを備えたクライアント側とサーバー側の証明書を使用しています。なぜそれが特定の回数だけ正常に動作し、その後吐くのかわかりません。また、反復の終わりに近づいた呼び出しでエラーがスローされるようです。また、このエラーは、クライアント側とサーバー側で同じように設定されているタイムアウトに達するずっと前に発生します。

<binding name="WSHttpBinding_IMyService" 
         closeTimeout="00:10:00" openTimeout="00:10:00" 
         receiveTimeout="00:10:00" sendTimeout="00:10:00"... />

さらに、サービスのスロットリングを使用しています。

<serviceThrottling 
       maxConcurrentCalls="100" 
       maxConcurrentSessions="100" />

何か案は?

ありがとう、マーク。

4

1 に答える 1

0

呼び出しの数が特定の制限に達し、呼び出しごとに独自のプロキシが作成されると、エラーが発生します。

したがって、エラーはおそらくプロキシの作成または終了とクリーンアップに関連しています。

コードを投稿していませんが、次のベスト プラクティスに従って問題を解決し、コードのパフォーマンスを向上させることができる場合があります: http://blogs.msdn.com/wenlong/archive/2007/10/27/performance -wcf-client-proxy-creation-and-best-practices.aspx の改善

非同期 wcf 呼び出しに関するもう 1 つの典型的な問題は、非同期呼び出しが戻る前にプロキシが閉じられていないことを確認することです。

于 2010-01-23T12:27:55.093 に答える