无法将大数据发送到WCF服务器

时间:2015-01-13 00:44:41

标签: wcf

我无法将大数据发送到wcf服务器,尽管我配置了它。

发送小数据可以正常工作。

数据是TimeSpan,GUID,int,bool,string。当string.Length大于45000时 - 它失败

在我的服务器配置中:

  <bindings>
        <basicHttpBinding>
            <binding name="BasicHttpBinding_IWcfService" 
                     maxBufferSize="1048576000"
                     maxBufferPoolSize="524288000"
                     maxReceivedMessageSize="1048576000">
                    <readerQuotas maxDepth="2147483647"
                             maxStringContentLength="2147483647"
                             maxArrayLength="2147483647" 
                             maxBytesPerRead="2147483647"
                             maxNameTableCharCount="2147483647" />
           </binding>
        </basicHttpBinding>
    </bindings>   


 <services>
        <service name="Receiver.StorageHandlerService">
            <endpoint address="" binding="basicHttpBinding" contract="Receiver.ISorageHandlerService">
                <identity>
                    <dns value="localhost"/>
                </identity>
            </endpoint>
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
            <host>
                <baseAddresses>
                    <add baseAddress="http://99.99.99.99:8733/Design_Time_Addresses/Receiver/StorageHandlerService/"/>
                </baseAddresses>
            </host>
        </service>
    </services>

在我的客户端配置中:

bindings>
        <basicHttpBinding>
            <binding name="BasicHttpBinding_ISorageHandlerService" 

                     maxBufferSize="1048576000"
                     maxBufferPoolSize="524288000"
                     maxReceivedMessageSize="1048576000">
                    <readerQuotas maxDepth="2147483647"
                             maxStringContentLength="2147483647"
                             maxArrayLength="2147483647" 
                             maxBytesPerRead="2147483647"
                             maxNameTableCharCount="2147483647" />
            </binding>
        </basicHttpBinding>
    </bindings>
    <client>
        <endpoint address="http://99.99.99.99:8733/Design_Time_Addresses/Receiver/StorageHandlerService/"
            binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ISorageHandlerService"
            contract="ServiceData.ISorageHandlerService" name="BasicHttpBinding_ISorageHandlerService" />
    </client>

谢谢!

1 个答案:

答案 0 :(得分:1)

虽然您在服务配置中配置了大于默认值的绑定,但由于未将其分配给端点,因此未使用该绑定。要分配您指定的绑定配置,您需要在服务配置中的bindingCongfiguration元素上使用endpoint属性(类似于设置客户端配置的方式),如下所示:

<services>
    <service name="Receiver.StorageHandlerService">
        <endpoint address="" binding="basicHttpBinding" 
                  bindingConfiguration="BasicHttpBinding_IWcfService"
                  contract="Receiver.ISorageHandlerService">

您发布的配置未指定basicHttpBinding的配置,因此使用默认的BasicHttpBinding实例,其中包含各种设置的默认值。