maxReceivedMessageSize不固定413:请求实体太大 [英] maxReceivedMessageSize not fixing 413: Request Entity Too Large

查看:1046
本文介绍了maxReceivedMessageSize不固定413:请求实体太大的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要我的WCF Web服务调用失败与 System.Net.WebException:请求失败,HTTP状态413:请求实体太大

My call to my WCF web service is failing with System.Net.WebException: The request failed with HTTP status 413: Request Entity Too Large.

检查提琴手,我看到,我要送:

Checking Fiddler, I see that I'm sending:

内容长度:149839

Content-Length: 149839

这是超过65KB。

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

Enabling WCF tracing on the server, I see:

System.ServiceModel.ProtocolException:最大邮件大小配额   传入消息(65536)已被超过。为了增加   配额使用MaxReceivedMessageSize财产上的相应   绑定元素。

System.ServiceModel.ProtocolException: The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element.

添加此属性并没有解决问题。

Adding this property doesn't solve the issue.

我试着只是财产,(后)与各种其他人的帖子建议。下面是我目前的(在服务器上)

I've tried with just that property, and (later) with various others that posts have suggested. Here's what I have currently (on the server):

<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>

我唯一的端点(下&LT;客户端&GT; )是:

<endpoint address="/NetPricingService/Service.asmx"
  binding="basicHttpBinding" bindingConfiguration="PricerServiceSoap"
  contract="Pricing.PricerService.PricerServiceSoap"
  name="PricerServiceSoap" />

我还补充道:

I've also added:

<dataContractSerializer maxItemsInObjectGraph="2147483647"/>

&LT;行为&GT;

我甚至运行(IIS 7):

I've even run (for IIS 7):

%windir%\system32\inetsrv\appcmd set config "WebServicesDev/PricingService"
-section:requestFiltering -requestLimits.maxAllowedContentLength:104857600
-commitpath:apphost

没有什么差别。

Nothing makes any difference.

一个美中不足的是,这是一个WCF服务,用来取代较旧的ASMX服务。从现有的WSDL SvcUtil工具生成的服务框架。我无法改变的客户端配置(和客户端有多种语言)。我的测试客户端项目引进的具有添加Web引用的服务(在添加服务引用/高级),所以我没有WCF配置。然而,测试客户端的工作,如果我在旧的ASMX服务点吧。

One catch is that this is a WCF service meant to replace an older ASMX service. The service skeleton was generated with svcutil from existing WSDL. I can't change the client configurations (and the clients are in multiple languages). My test client project imported the service with Add Web Reference (under Add Service Reference / Advanced), so I have no WCF configuration. However, the test client works if I point it at the older ASMX service.

我怎样才能解决或诊断呢?

How can I fix or diagnose this?

其他信息

如果我用的是微软服务配置编辑器生成的配置(设定maxReceivedMessageSize和maxBufferSize),它的工作原理。问题是,再根据&LT指定的端点;服务&GT; ,它不会让我指定/NetPricingService/Service.asmx相对地址。如果我在SvcUtil工具生成的配置编辑绑定(其中终点是在&LT;客户端&GT; ),它不会有大的请求工作

If I use the Microsoft Service Configuration Editor to generate the config (setting maxReceivedMessageSize and maxBufferSize), it works. The problem is that the endpoint is then specified under <service>, and it won't let me specify the /NetPricingService/Service.asmx relative address. If I edit the bindings in the svcutil-generated config (where the endpoint is under <client>), it doesn't work with large requests.

推荐答案

答案在盯着我的脸。

由SvcUtil工具生成的配置是客户端。我用它在服务器上。

The config generated by svcutil was for the client. I was using it on the server.

我是编辑绑定在指定的终点&LT;客户机GT; ,这让绝对不会影响到服务

I was editing the bindings for the endpoints specified under <client>, which made absolutely no difference to the service.

添加适当的&LT;服务&GT; 终端和设置maxReceivedMessageSize和maxBufferSize其绑定解决了问题。

Adding a proper <service> endpoint and setting the maxReceivedMessageSize and maxBufferSize on its binding resolved the issue.

这篇关于maxReceivedMessageSize不固定413:请求实体太大的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆