WCF応答メッセージに40分かかり、タイムアウト例外がスローされない
-
05-07-2019 - |
質問
IIS7でホストされているWCFサービスがあります(サービスとクライアントの構成はこの投稿の最後にあります)。私は誰かがそれを攻撃して解決策を見つける方法についていくつかのアイデアを持っていることを望んでいたという奇妙なシナリオに出くわしました。
サービスは、1つのコントラクト「ProcessMessage」のみを公開します。そのコントラクトを使用して、期待されるパフォーマンスで問題なくそのサービスを使用して同期メッセージを送受信できますが、そのコントラクトを呼び出すと、65KBを超えるデータが返されます。約1 MB。最初に呼び出したときに、予想される最大受信サイズ超過エラーを受け取りました。そのため、maxReceivedMessageSizeを増やしたところ、この特定の呼び出しはクライアントに戻るのに40分かかりました。これは、タイムアウト設定をはるかに超えており、予想されるものをはるかに超えています。サーバー側の処理時間はわずか2秒です。クライアント側で保留されているようです。
また、ファイル内の他のいくつかのクォータを使用できないように増やしました。
どんな考えでも大歓迎です。ありがとう。
サービス構成:
<system.serviceModel>
<services>
<service behaviorConfiguration="Lrs.Esf.Facade.Startup.FacadeBehavior"
name="Lrs.Esf.Facade.Startup.FacadeService">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="default" contract="Lrs.Esf.Facade.Startup.IFacadeService">
<identity>
<servicePrincipalName value="lrsdomain/PensionDev" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<bindings>
<wsHttpBinding>
<binding name="default">
<security mode="None"/>
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="Lrs.Esf.Facade.Startup.FacadeBehavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true" />
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
クライアント構成:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IFacadeService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:1:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="52428800" maxReceivedMessageSize="6553600"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="None">
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://esf2.facade.testpe.pg.local/FacadeWcf/FacadeService.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IFacadeService"
contract="FacadeServiceReference.IFacadeService" name="WSHttpBinding_IFacadeService">
<identity>
<servicePrincipalName value="lrsdomain/PensionDev" />
</identity>
</endpoint>
</client>
解決 2
問題の基本的な原因と回避策を見つけましたが、追加の洞察は素晴らしいでしょう。
DataSetは、WCFによってXML形式でシリアル化されていました。 DataSetを強制的にbyte []としてシリアル化し、時間を4秒に短縮しました。 1つの推測は、HTTP通信が有効になるように4MBのXMLのすべての文字をエスケープすることが問題の原因であるということです。
他のヒント
サーバー側のさまざまなパラメーターのサイズを大きくしなかったようです-間違いなく試してみてください!サーバー側のクライアント設定ファイルからもバインディング設定を使用します-デフォルトの64Kメッセージサイズのままなので、サービスは窒息している可能性があります。
また、クライアントバインディングの receiveTimeout
は少しおかしいです-ゼロ桁がありません:
<binding name="WSHttpBinding_IFacadeService"
receiveTimeout="00:1:00"
receiveTimeout =&quot; 00:01:00&quot;
マーク