0

コールバックを使用して、25 MB を超えるサイズのデータ​​を複数のクライアントに同時に送信しようとしています。wsdualhttp バインディングを使用してサービスを実装しました。サービスが同時に 3 つ以上のクライアントにデータを送信しようとすると、「System.OutofMemory」および「メモリの割り当てに失敗しました」という例外がスローされます。serviceThrottling、maxItemsInObjectGraph、および maxBufferPoolSize に関連する値を設定しました。また、ストリーミングも使えません。これを達成する方法はありますか?

// サーバ側

<?xml version="1.0"?>
<configuration>
<system.net>
<connectionManagement>
  <add address="*" maxconnection="2147483647"/>
</connectionManagement>
</system.net>  
<system.serviceModel>     
  <bindings>
   <wsDualHttpBinding>
     <binding name="WSConfig" closeTimeout="00:10:00" openTimeout="00:01:00" 
              receiveTimeout="00:20:00" sendTimeout="00:20:00" bypassProxyOnLocal="false" 
              transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" 
              maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" >
       <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
       <reliableSession ordered="true" inactivityTimeout="00:10:00"/>
     </binding>
   </wsDualHttpBinding>
 </bindings>     
 <services>
   <service behaviorConfiguration="ServiceBehavior"     name="CallbackService.MycallbackService">
     <endpoint address="http://localhost:8000/MycallbackService/MyService" binding="wsDualHttpBinding" contract="CallbackService.IServiceContract" bindingConfiguration="WSConfig">
         <identity>
         <dns value="localhost"/>
       </identity>           
     </endpoint>                 
   </service>       
 </services>
 <behaviors>
   <serviceBehaviors>
     <behavior name="ServiceBehavior">
       <serviceMetadata httpGetEnabled="true"/>
       <serviceDebug includeExceptionDetailInFaults="false "/>
      <serviceThrottling maxConcurrentCalls="2147483647" maxConcurrentInstances="2147483647" maxConcurrentSessions="1000"/>
       <dataContractSerializer maxItemsInObjectGraph="2147483646"/>           
     </behavior>
   </serviceBehaviors>
 </behaviors>      
</system.serviceModel>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>    
</configuration>

//クライアント側

<?xml version="1.0"?>
<configuration>
<system.net>
<connectionManagement>
  <add address ="*" maxconnection = "2147483647" />
</connectionManagement>
</system.net>
<system.serviceModel>
<bindings>
  <wsDualHttpBinding>
    <binding name ="WSConfig" closeTimeout="00:10:00"
   openTimeout="00:01:00" receiveTimeout="00:20:00" sendTimeout="00:20:00"
   bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
   maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
   messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true">
      <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
      maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
      <reliableSession ordered="true" inactivityTimeout="00:10:00"/>
    </binding>
  </wsDualHttpBinding>
</bindings>
<client>
  <endpoint address="http://localhost:8000/MycallbackService/MyService" binding="wsDualHttpBinding" contract="CallbackService.IServiceContract" bindingConfiguration ="WSConfig">     
  </endpoint>
</client>
</system.serviceModel>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
</startup>    

4

1 に答える 1

0

まだこれを調べている人のために:私は同じ問題を抱えていて、交換されたデータがシリアライザー/デシリアライザーには大きすぎることが判明しました。これにより、System.OutofMemory エラーが発生しました。他のバインディングを試してみることをお勧めします (バイナリ エンコーディングをサポートする NetTcpBinding など)。

また、クライアントとサービスの両方が同じアーキテクチャ用にコンパイルされていることを確認してください (サービスが 64 ビットの名前空間に対応し、クライアントが 32 ビット用にコンパイルされている場合、System.OutofMemory 例外が発生することになります)。

于 2014-06-05T08:03:02.570 に答える