首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用wsDualHttpbinding传输大量数据失败

使用wsDualHttpbinding传输大量数据失败
EN

Stack Overflow用户
提问于 2013-12-05 20:54:49
回答 1查看 788关注 0票数 0

我正在尝试使用回调将大于25MB的数据同时发送到多个客户端。我已经使用wsdualhttp绑定实现了该服务。当服务尝试并发发送数据到3个以上的客户端时,会抛出"System.OutofMemory“和"Failed to allocate”异常。我已经为serviceThrottling、maxItemsInObjectGraph和maxBufferPoolSize设置了相关的值。另外,我不能使用流媒体。有没有办法做到这一点?

//服务端

代码语言:javascript
复制
<?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>

//客户端

代码语言:javascript
复制
<?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>    

EN

回答 1

Stack Overflow用户

发布于 2014-06-05 16:03:03

对于那些还在研究这个问题的人:我也遇到过同样的问题,结果发现交换的数据对于serlializer/反序列化程序来说太大了。这反过来会导致System.OutofMemory错误。您可能希望尝试一些其他绑定(例如,支持二进制编码的NetTcpBinding )。

另外:确保您的客户端和服务都针对相同的体系结构进行了编译(如果您的服务针对64位命名空间进行了编译,而您的客户端针对32位进行了编译,那么您肯定会得到System.OutofMemory异常

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20400605

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档