我有一个wpf应用程序发送一个DataSet
近25 DataTable
。我无法修复同步和异步的The remote server returned an unexpected response: (400) Bad Request
。下面是在app.config:发送大数据集到WCF服务给出协议例外
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_ICommunication" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="01:00:00" sendTimeout="01:00:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483647" maxBufferPoolSize="2147483647" 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>
<client>
<endpoint address="http://localhost:49486/Communication.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ICommunication"
contract="CommunicationReference.ICommunication" name="BasicHttpBinding_ICommunication" />
</client>
</system.serviceModel>
</configuration>
,这是服务的web.config:
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<httpRuntime maxRequestLength="2147483647" executionTimeout="10000"/>
</system.web>
<connectionStrings>
<add name="conName" connectionString="Data Source=*******;Initial Catalog=****; User ID=**; Password=*****"/>
</connectionStrings>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
<serviceThrottling maxConcurrentCalls="100" maxConcurrentSessions="1000" maxConcurrentInstances="1600" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
P.S:我路过空白DataSet
,其工作进行了测试。但DataSet
与DataTable
它不能正常工作。
你有你的WCF服务定义readerQuotas相同的设置?还启用跟踪(http://msdn.microsoft.com/en-us/library/ms733025.aspx)并检查跟踪文件以查看导致400错误请求异常的原因 – Rajesh
您可以将服务器的代码发布到哪里返回你的数据表? – evgenyl
我没有回来,我将它传递给网络服务 – Arshad