Wcf 使用wsDualHttpbinding的大型数据传输失败

Wcf 使用wsDualHttpbinding的大型数据传输失败,wcf,out-of-memory,wcf-callbacks,wsdualhttpbinding,duplex-channel,Wcf,Out Of Memory,Wcf Callbacks,Wsdualhttpbinding,Duplex Channel,我正在尝试使用回调同时向多个客户端发送大小大于25 MB的数据。我已经用wsdualhttp绑定实现了该服务。当服务试图同时向3个以上的客户端发送数据时,它抛出“System.OutofMemory”和“分配内存失败”异常。我已经为serviceThrottling、maxItemsInObjectGraph以及maxBufferPoolSize设置了相关值。而且,我不能使用流媒体。有没有办法做到这一点 //服务器端 <?xml version="1.0"?> <configu

我正在尝试使用回调同时向多个客户端发送大小大于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>    


对于那些仍在研究这一问题的人:我也遇到了同样的问题,结果是交换的数据对于serlializer/deserializer来说太大了。这进而导致System.OutofMemory错误。您可能需要尝试其他绑定(例如支持二进制编码的NetTcpBinding)


另外:请确保您的客户端和服务都是为相同的体系结构编译的(如果您的服务地址为64位命名空间,而您的客户端为32位编译,那么您将绑定到System.OutofMemory exceptions

服务器端还是客户端失败?您能共享绑定配置吗?我已经编辑了您的标题。请参阅“”“,其中一致意见是“不,他们不应该”。请发布您的配置文件。设置并发回调的数量限制是一个好的解决方案吗?@rene:我已经共享了配置文件。@Jocke:我认为问题不在于并发调用的数量。