[英]Large data transfer using wsDualHttpbinding fails
I'm trying to send data of size greater than 25 MB to multiple clients at the same time using callbacks. 我正在尝试使用回调同时将大小大于25 MB的数据发送到多个客户端。 I have implemented the service with wsdualhttp binding.
我已经使用wsdualhttp绑定实现了该服务。 It throws "System.OutofMemory" and "Failed to allocate memory" exceptions when the service tries to send the data to more than 3 clients concurrently.
当服务尝试同时将数据发送到3个以上的客户端时,它将引发“ System.OutofMemory”和“分配内存失败”异常。 I have set relevant values for serviceThrottling, maxItemsInObjectGraph as well as maxBufferPoolSize.
我已经为serviceThrottling,maxItemsInObjectGraph和maxBufferPoolSize设置了相关的值。 Also, I cannot use streaming.
另外,我不能使用流媒体。 Is there a way to achieve this?
有没有办法做到这一点?
// Server Side // 服务器端
<?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>
//Client Side //客户端
<?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>
For those still looking into this: I've had the same problem and it turned out that the data exchanged were too big for the serlializer/deserializer. 对于那些仍在研究这一问题的人:我也遇到了同样的问题,事实证明,对于串化器/解串器而言,交换的数据太大。 This in turn caused System.OutofMemory errors.
这进而导致System.OutofMemory错误。 You may want to try some other binding (For example NetTcpBinding which supports binary encoding)
您可能需要尝试其他一些绑定(例如,支持二进制编码的NetTcpBinding)
Also: Make sure that both your client and service are compiled for the same architecture (if your service addresses a 64bit namespace and your client compiled for 32bit, then you're bound to get System.OutofMemory exceptions 另外:确保您的客户端和服务都针对相同的体系结构进行编译(如果您的服务使用64位命名空间,而客户端则针对32位进行编译,那么您肯定会遇到System.OutofMemory异常
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.