Windows 客户端配置设置

Windows 客户端配置设置,windows,wcf,configuration,client,Windows,Wcf,Configuration,Client,我有一个windows应用程序,它调用WCF服务来构建特定的URL 从windows应用程序调用的WCF函数接受数组形式的位置详细信息 我面临一个问题,当发送到WCF函数的数组大小很小(例如10)时,服务返回正确的结果 但当数组大小增加(例如>200)时,服务返回400个错误请求 我不确定数组大小或数组内容是否导致此问题 我已尝试更改服务器(服务)端web.config以接受最大缓冲区大小 <bindings> <basicHttpBinding> <binding

我有一个windows应用程序,它调用WCF服务来构建特定的URL

从windows应用程序调用的WCF函数接受数组形式的位置详细信息

我面临一个问题,当发送到WCF函数的数组大小很小(例如10)时,服务返回正确的结果

但当数组大小增加(例如>200)时,服务返回400个错误请求

我不确定数组大小或数组内容是否导致此问题

我已尝试更改服务器(服务)端web.config以接受最大缓冲区大小

<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IServiceContract" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" 

sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" 

maxBufferSize="2147483647" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647" messageEncoding="Text" 

textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" 

maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>


</basicHttpBinding>
</bindings>

<system.web>
    <compilation debug="true" targetFramework="4.0" />
            <httpRuntime executionTimeout="90" maxRequestLength="1048576" useFullyQualifiedRedirectUrl="false" 

minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="100" />
  </system.web>

我仍然面临着同样的问题


在客户端(此处为windows应用程序),我们如何设置配置设置,以便客户端能够向服务器端发送大数据?

您需要在客户端进行更改。更改
maxBufferSize
maxReceivedMessageSize
。就在昨天,我遇到了一个类似的问题,并通过将这些值重置为更高的值来修复它


注意:事实上,我没有对服务(服务器)进行任何更改。

您需要增加服务器配置文件和客户端配置文件中的读卡器配额

<readerQuotas maxDepth="2147483647" 
maxStringContentLength="2147483647" 
maxArrayLength="2147483647" 
maxBytesPerRead="2147483647" 
maxNameTableCharCount="2147483647" />

以及maxReceivedMessageSize和bufferSize:

<httpTransport transferMode="Buffered"
maxReceivedMessageSize="2147483647"
maxBufferSize="2147483647"/>

您可能还需要将dataContractSerializer添加到您的服务行为中

<serviceBehaviors>
<behavior name="Your SB">
<serviceMetadata httpGetEnabled="True"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
<serviceDebug 
includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>