HTTP / 1.1 413请求实体太大 [英] HTTP/1.1 413 Request Entity Too Large

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

问题描述

大家好

当我尝试将base64编码的字符串发送到网络方法时,我在响应标头中获取HTTP / 1.1 413请求实体太大



Web方法接受JSON。这适用于小图像(编码为base64字符串),但我想知道为什么它不适用于大型图像,例如250 KB



i尝试更改maxJsonLength属性

Hi all
I am getting HTTP/1.1 413 Request Entity Too Large in the response header when i try to send base64 encoded string to a web method

The web method accepts JSON. This works fine for small images (encoded as base64 string) but i am wondering why its not working for large images for instance 250 KB

i tried to change maxJsonLength property

<system.web.extensions>
    <scripting>
      <webServices><jsonSerialization maxJsonLength="33554432">....



to


to

<jsonSerialization maxJsonLength="2147483647">...





但更改此值无效且仍然获得HTTP / 1.1 413请求实体太大而无法显示大图像



设置maxJsonLength的任何想法都不起作用...

谢谢



but changing this value have no effect and still getting HTTP/1.1 413 Request Entity Too Large for large images

Any ideas why setting maxJsonLength is not working...
thanks

推荐答案

事实上,我自己找到了它,经过一些谷歌搜索和一个很棒的链接 HTTP: //tech.avivo.si/2011/10/increase-maximum-request-length-for-wcf-rest-web-service-asp-net-4/ [ ^ ]



Actually i found it myself ,after some googling and an awesome link http://tech.avivo.si/2011/10/increase-maximum-request-length-for-wcf-rest-web-service-asp-net-4/[^]

<bindings>
      <!-- Customizations for REST service -->
      <webHttpBinding>
        <!-- Limits set to 10 MB (specified value in bytes) -->
        <binding name="ApiQuotaBinding" maxReceivedMessageSize="10485760" 

maxBufferPoolSize="10485760" maxBufferSize="10485760" closeTimeout="00:03:00" 

openTimeout="00:03:00" receiveTimeout="00:10:00" sendTimeout="00:03:00">
          <readerQuotas maxDepth="32" maxStringContentLength="10485760" 

maxArrayLength="10485760" maxBytesPerRead="10485760" />
          <security mode="None" />
        </binding>
      </webHttpBinding>
    </bindings>





- - 在端点部分引用绑定ApiQuotaBinding



----in the endpoint section make a reference to binding ApiQuotaBinding

 <!-- Added attribute 'bindingConfiguration' -->
        <endpoint address="" bindingConfiguration="ApiQuotaBinding" binding="webHttpBinding" 

contract="Avivo.Web.Services.IApiService" behaviorConfiguration="ApiBehavior" ></endpoint>


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

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