相关疑难解决方法(0)

maxReceivedMessageSize没有修复413:请求实体太大

我对WCF Web服务的调用失败了 System.Net.WebException: The request failed with HTTP status 413: Request Entity Too Large.

检查提琴手,我看到我正在发送:

内容长度:149839

超过65KB.

在服务器上启用WCF跟踪,我看到:

System.ServiceModel.ProtocolException:已超出传入邮件的最大邮件大小配额(65536).要增加配额,请在相应的绑定元素上使用MaxReceivedMessageSize属性.

添加此属性不能解决问题.

我已经尝试过这个属性,并且(稍后)与帖子建议的各种其他人一起尝试过.这是我目前(在服务器上):

<basicHttpBinding>

  <binding name="PricerServiceSoap"
    closeTimeout="00:10:00" openTimeout="00:10:00"
    receiveTimeout="00:10:00" sendTimeout="00:10:00"
    maxBufferSize="2147483647"    
    maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">

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

</basicHttpBinding>
Run Code Online (Sandbox Code Playgroud)

我唯一的终点(下<client>)是:

<endpoint address="/NetPricingService/Service.asmx"
  binding="basicHttpBinding" bindingConfiguration="PricerServiceSoap"
  contract="Pricing.PricerService.PricerServiceSoap"
  name="PricerServiceSoap" />
Run Code Online (Sandbox Code Playgroud)

我还补充说:

<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
Run Code Online (Sandbox Code Playgroud)

<behavior>.

我甚至跑(对于IIS 7):

%windir%\system32\inetsrv\appcmd set config "WebServicesDev/PricingService"
-section:requestFiltering -requestLimits.maxAllowedContentLength:104857600
-commitpath:apphost
Run Code Online (Sandbox Code Playgroud)

没有任何区别.

一个问题是,这是一个WCF服务,旨在取代旧的ASMX服务.服务框架是使用现有WSDL中的svcutil生成的.我无法更改客户端配置(客户端使用多种语言).我的测试客户端项目使用Add Web Reference(下Add Service Reference / Advanced)导入了该服务,因此我没有WCF配置.但是,如果我将它指向较旧的ASMX服务,则测试客户端可以正常工作.

我该如何修复或诊断?

附加信息 …

iis wcf web-config .net-4.0 wcf-binding

26
推荐指数
3
解决办法
6万
查看次数

标签 统计

.net-4.0 ×1

iis ×1

wcf ×1

wcf-binding ×1

web-config ×1