2

我和我的同事一直在努力解决向 Web 服务发送超过 8192 字节数据的问题。我尝试创建一个简单的 WCF 项目来测试发送一些数据,但它仍然在 8192+ 字节时失败。我已经阅读了数百个网页并对 web.config 文件进行了更改,以确保元素足够大,但它仍然无法正常工作。

任何建议,将不胜感激。

我们正在使用本地主机上的 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>
4

1 回答 1

0

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

WCF 跟踪 MSDN

于 2013-05-08T11:05:17.630 回答