簡體   English   中英

使用wsDualHttpbinding的大數據傳輸失敗

[英]Large data transfer using wsDualHttpbinding fails

我正在嘗試使用回調同時將大小大於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>    

對於那些仍在研究這一問題的人:我也遇到了同樣的問題,事實證明,對於串化器/解串器而言,交換的數據太大。 這進而導致System.OutofMemory錯誤。 您可能需要嘗試其他一些綁定(例如,支持二進制編碼的NetTcpBinding)

另外:確保您的客戶端和服務都針對相同的體系結構進行編譯(如果您的服務使用64位命名空間,而客戶端則針對32位進行編譯,那么您肯定會遇到System.OutofMemory異常

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM