2012-02-17 10 views
2

私はC#で書いたWCFサービスを持っています。このサービスは呼び出し元(C#WPFアプリケーション)にインスタンス化されたオブジェクトのコレクションを渡します。ただし、戻ってくるコレクションにオブジェクトが多すぎる場合は、約10秒後にクライアント側でコールが失敗します(それ自体に一連の汎用内部例外が含まれています)。ここで例外と内部例外である:あまりにも多くのデータが通過したためにWCFサービスコールが失敗しますか?

http://myserver/MyAppService/MyAppService.svcにHTTP応答を受信しながら、{ "エラーが発生しました。これは、これは もが原因である可能性があり起因 にHTTPプロトコルを使用していない結合サービスエンドポイントとすることができます。 "詳細については、サーバーログを参照してください。"}
{"基本接続が閉じられました:受信時に予期しないエラーが発生しました。"}
{"トランスポート接続からデータを読み取ることができません:既存の接続がリモートホストによって強制的に閉じられました。「}
は、{」既存の接続を強制的に問題が100%再生可能であり、間違いなくコレクションのサイズではなく、コンテンツに関連する

} "リモートホストによって閉じました。私はこれを知っています。なぜなら、単一のコレクションを複数の小さなコレクションに分割し、それらを一度に1つずつ渡すと、うまく動作するからです。彼らが一緒に集まり、コレクションが大規模になるときだけ、それは問題です。

クライアント側のapp.configファイルのmaxReceivedMessageSizeプロパティを2147483647に増やしてみましたが、エラーは引き続き発生します。また、タイムアウト期間を増やしてみましたが、影響はありません。以下は、app.configファイルのプロパティです。私は2147483647にかなりの下のすべての数を増やしてみましたし、0にmaxBufferPoolSizeを変更しようとしたが、運ました:

<bindings> 
    <basicHttpBinding> 
    <binding name="BasicHttpBinding_iMyAppService" 
     closeTimeout="01:00:00" openTimeout="01:00:00" 
     receiveTimeout="01:00:00" sendTimeout="01:00:00" 
     allowCookies="false" bypassProxyOnLocal="false" 
     hostNameComparisonMode="StrongWildcard" 
     maxBufferSize="2147483647" maxBufferPoolSize="524288" 
     maxReceivedMessageSize="2147483647" 
     messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" 
     useDefaultWebProxy="true"> 
     <readerQuotas 
      maxDepth="32" maxStringContentLength="8192" 
      maxArrayLength="16384" maxBytesPerRead="4096" 
      maxNameTableCharCount="16384" /> 
     <security mode="None"> 
     <transport clientCredentialType="None" proxyCredentialType="None" 
      realm="" /> 
     <message clientCredentialType="UserName" algorithmSuite="Default" /> 
     </security> 
    </binding> 
    </basicHttpBinding> 
    <wsHttpBinding> 
    <binding name="WSHttpBinding_iMyAppService" 
     closeTimeout="00:01:00" openTimeout="00:01:00" 
     receiveTimeout="00:10:00" sendTimeout="00:01:00" 
     bypassProxyOnLocal="false" transactionFlow="false" 
     hostNameComparisonMode="StrongWildcard" 
     maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647" 
     messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" 
     allowCookies="false"> 
     <readerQuotas 
      maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 
      maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
     <reliableSession ordered="true" inactivityTimeout="00:10:00" 
     enabled="false" /> 
     <security mode="Message"> 
     <transport clientCredentialType="Windows" proxyCredentialType="None" 
      realm="" /> 
     <message clientCredentialType="Windows" negotiateServiceCredential="true" 
      algorithmSuite="Default" /> 
     </security> 
    </binding> 
    </wsHttpBinding> 
</bindings> 
<client> 
    <endpoint name="CurrencyConvertorSoap" 
     address="http://www.webservicex.net/CurrencyConvertor.asmx" 
     binding="basicHttpBinding" 
     bindingConfiguration="CurrencyConvertorSoap" 
     contract="CurrencyConverterService.CurrencyConvertorSoap" /> 

    <endpoint name="CurrencyConvertorSoap12" 
     address="http://www.webservicex.net/CurrencyConvertor.asmx" 
     binding="customBinding" 
     bindingConfiguration="CurrencyConvertorSoap12" 
     contract="CurrencyConverterService.CurrencyConvertorSoap" /> 

    <endpoint name="WSHttpBinding_iMyAppService" 
     address="http://myserver/MyAppService/MyAppService.svc" 
     binding="wsHttpBinding" 
     bindingConfiguration="WSHttpBinding_iMyAppService" 
     contract="MyAppService.iMyAppService" > 
    <identity> 
     <dns value="localhost" /> 
    </identity> 
    </endpoint> 

    <endpoint name="BasicHttpBinding_iMyAppService" 
     address="http://myserver/MyAppService/MyAppService.svc" 
     binding="basicHttpBinding" 
     bindingConfiguration="BasicHttpBinding_iMyAppService" 
     contract="MyAppService.iMyAppService" /> 
</client> 

私はこの仕事をするために他に何を変更したり追加することができますか?

ありがとうございます!

答えて

2

maxitemsinobjectgraphにすることができます。 wcfトレースを有効にすると、そこにスタックトレースが表示されます。

+0

ダン...私は本当にあなたの応答を読んだときにそれがそれだと思っていましたが、残念ながら行っていません。もし私がそれを正しくしなかったら。 <行動名= "Behaviors.EndpointBehavior"> し、この私に:しかし、私は、私はapp.configにこれを追加しました終点ライン:behaviorConfiguration = "Behaviors.EndpointBehavior"しかし、もう一度...残念ながら働かなかった。同じエラー。しかし、助けてくれてありがとう。 – Nullqwerty

+1

私は自分のPCではありませんが、ホスト*と*クライアントで設定を行う必要があると思いますか?それを試しましたか(これは@felanの設定でも同じです)。 –

+0

私はFelanの提案を試みましたが、それは残念ながらそれを修正しませんでした。私はmaxitemsinobjectgraphの動作をサーバー側のweb.configに追加しようとしましたが、それはしませんでした。私はFelanをサーバー側に追加することはできませんでした。なぜなら、web.configにはどこのオプションもないので、どこに置くべきかわからなかったからです。 – Nullqwerty

2

私が思い起こされるように、私は同じような発音の状況になる前にmaxArrayLengthを上げる必要がありました。

+0

私は2147483647にそれを増加しようとしましたが、同じエラーが発生しました。とにかくありがとう。 – Nullqwerty

+1

また、maxStringContentLength = "8192"を増やす必要があります。maxArrayLengthを大きくしないでください。 – Felan

+0

試しました...残念ながら行きません。しかし、ありがとう。 – Nullqwerty

関連する問題