2013-05-08 103 views
2

我和我的同事们一直在试图解决发送超过8192字节数据到Web Service的问题。我已经尝试创建一个简单的WCF项目来测试发送一些数据,但它仍然失败在8192 +字节。我已经阅读了数百个网页,并对web.config文件进行了更改,以确保元素足够大,但仍不起作用。无法增加最大字符串内容长度限额(8192)

任何建议,将不胜感激。

我们正在使用本地主机上的IIS Express作为Web服务器并使用WCFTestClient向服务发送数据来测试该服务。我们也尝试使用Storm作为将数据发送到Web服务的客户端。

<?xml version="1.0"?> 
<configuration> 

    <system.web> 
    <compilation debug="true" targetFramework="4.0" /> 
    </system.web> 
    <system.serviceModel> 
    <client> 
     <endpoint binding="basicHttpBinding" bindingConfiguration="NewBinding0" 
     contract="IService1" name="ClientEndPointName" /> 
    </client> 
    <services> 
     <service name="Service1"> 
     <endpoint address="http://localhost:2787" binding="basicHttpBinding" 
      bindingConfiguration="NewBinding0" name="DROServiceX" bindingName="DROBindingName" 
      contract="IService1" isSystemEndpoint="false" /> 
     </service> 
    </services> 
    <bindings> 
     <basicHttpBinding> 
     <binding name="NewBinding0" transferMode="Buffered"> 
      <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" 
     maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> 
     </binding> 
     </basicHttpBinding> 
    </bindings> 
    <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"/> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    <serviceHostingEnvironment aspNetCompatibilityEnabled="false" 
    multipleSiteBindingsEnabled="true" /> 
    </system.serviceModel> 
<system.webServer> 
    <modules runAllManagedModulesForAllRequests="true"/> 
    </system.webServer> 

</configuration> 
+0

客户端也有各种超时和限制。你配置了那些? – 2013-05-08 10:10:48

+0

这其他[SO线程](http://stackoverflow.com/questions/8225736/transfer-large-amount-of-data-in-wcf-service)可能会有所帮助。 – 2013-05-08 10:23:30

回答

0

您应该在服务器和客户端上进行配置。如果其中一个未正确配置,请求将失败。您的服务器配置正确,因此您应该查看客户端配置。如果您真的知道发生了什么,请启动WCF跟踪以查看会发生什么。

WCF Tracing MSDN

相关问题