HTTP请求的制造&gt内容长度;身体尺寸 [英] Content Length of HTTP Request > body size

查看:265
本文介绍了HTTP请求的制造&gt内容长度;身体尺寸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我管理这是运行罚款近一在IIS 7.5中个月MVC 3.0 ASP.net内置的网站。时不时地,我们正面临着一个问题,当为被张贴的JSON是越来越截断我们的AJAX POST请求(通过jQuery的解雇)失败。

I'm managing a web site which is running fine for last couple of months over IIS 7.5 built with MVC 3.0 ASP.net. Every now and then we are facing a problem when our AJAX POST request (fired through jQuery) fails as the JSON being posted is getting truncated.

什么迄今为止我们发现的是,对所有这些请求,请求的内容长度标头有更多的数据比我们实际上是在请求获得。

What we've found so far is that for all such request, the "Content-Length" header of the request has more data than we are actually getting in the request.

我们已经将的maxRequestLength 可在我们的web.config 51200,我相信价值的 maxAllowedContentLength 有pretty大的默认值(我们已经未设置在我们的配置)。我也有的Content-Length低至7301(字节)失败的请求,但我们设法只得到2179个字节的吧。所以我不怀疑这是击中任何限制。

We've already set maxRequestLength to 51200 in our web.config and I believe the value of maxAllowedContentLength has a pretty large default value (we've not set that in our configuration). Also I have a failed request with "Content-Length" as low as 7301 (bytes) but we managed to get only 2179 bytes of it. So I'm not suspecting this to be hitting any limit.

对于有问题的请求,请求头如下:

Request Headers for a problematic request are as follows


  • 的Cache-Control:no-cache的

  • 连接:保持活动

  • 杂注:无缓存

  • 的Content-Length:7301

  • 内容类型:应用程序/ JSON的;字符集= UTF-8;

  • 接受:应用/ JSON,文本/ javascript中,的 / 的; Q = 0.01

  • 接受编码:gzip,紧缩

  • 接受语言:EN-US,连接; Q = 0.5

  • 的User-Agent:Mozilla的/ 5.0(Windows NT的6.1; WOW64; RV:15.0)的Gecko / 20100101火狐/ 15.0.1

  • X-请求 - 由于:XMLHtt prequest

  • Cache-Control: no-cache
  • Connection: keep-alive
  • Pragma: no-cache
  • Content-Length: 7301
  • Content-Type: application/json; charset=utf-8;
  • Accept: application/json, text/javascript, /; q=0.01
  • Accept-Encoding: gzip, deflate
  • Accept-Language: en-us,en;q=0.5
  • User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20100101 Firefox/15.0.1
  • X-Requested-With: XMLHttpRequest

任何想法??

更新:我已经能够进一步从我们的code隔离问题。采写接受JSON字符串,只是反序列化一个独立的控制器。在一个错误的情况下,它会记录错误。

Update : I've been able to further isolate the problem from our code. Have written an independent controller that accepts a JSON string and just deserializes it. In case of an error, it logs the error.

当我在50个请求循环打这个控制器与150个并发线程并行然后我得到了一些失误的地方,这个控制器接收JSON被截断。现在,我们正在极力专注于优化IIS和阅读更多有关可能涉及(目前我们正在与IIS默认参数运行)的各种参数。

When I hit this controller in parallel with 150 concurrent threads in a loop of 50 requests then I get a few failures where the JSON that this controller receives is truncated. Now we are strongly focussed on optimizing IIS and reading more about various parameters that may be related (currently we are running with default parameters on IIS).

我强烈地感到,150个并发连接,不应该是一个大问题,并感到由衷的希望调整一些参数,我们应该能够闯过这个问题。一旦我们得到过去的这个问题,将分享我的发现。

I strongly feel that 150 concurrent connections should not be a big deal and am sincerely hoping that tuning some parameters we should be able to get past this problem. Once we get past this problem, will share my findings.

*的更新2(十月八日)* 的:我有进一步收窄的问题。我在IIS中打开错误日志,发现我的失败请求读取数据时得到以下错误

*Update 2 (October 8) * : I have further narrowed down the problem. I turned on error log in IIS and discovered that my failed request gets the following error while reading data

BytesReceived = 0
ErrorCode = 2147943395
Error Description = "The I/O operation has been aborted because of either a thread exit or an application request.(0x800703e3)"

我发现有关IIS论坛此错误信息,但我还没有与所给定的(复式)建议进行试验。下面的链接可以是一个很好的起点,搜索更多关于这个

I am finding information about this error on iis forums but am yet to experiment with (mutliple) suggestions being given. The following link can be a good starting point for searching more on this

http://forums.iis.net/p/1149787/1917288.aspx

推荐答案

我终于想通了的原因和解决方案的修补程序。遗憾的是,并不适用于我所有的环境,而且有利于生产环境。在下面找到

I finally figured out the cause and the fix for the solution. Unfortunately it is not applicable for all my environments but helps the production environment. Find details below

这原来是由于在Windows 2008 R2,它使asp.net相信客户端已断开连接,它甚至没有时的错误。一种相同的修补程序可用,并且可以在 http://support.microsoft.com/kb/977453找到。解决方法是已经的Windows 2008 R2 SP1的一部分(从这里找到)。

This turns out to be due to a bug in Windows 2008 R2, where it makes asp.net to believe that a client has disconnected even when it hasn't. A hotfix for the same is available and can be found at http://support.microsoft.com/kb/977453. The fix is already part of Windows 2008 R2 SP1 (found from here).

虽然修复工作对我来说在运行Windows 2008 R2的一个环境,它不能应用于Windows 2008 R2 SP1的。不幸的是,问题还是可以对SP1的运行环境中再现,仍然未解决。我在 http://forums.iis.net/打开IIS上的论坛,针对此问题的新案例T / 1192310.aspx 并有跟踪它来代替。

While the hotfix worked for me on one environment running Windows 2008 R2, it can not be applied to Windows 2008 R2 with SP1. Unfortunately the problem can still be reproduced on the environments running on SP1 and remains un-resolved. I have opened a new case on IIS forums for this issue at http://forums.iis.net/t/1192310.aspx and will track it there instead.

要了解更多关于这个问题 - 你可以按照在 HTTP线程://论坛.iis.net / p / 1149787 / 1917288.aspx

To read more about this issue - you can follow the thread at http://forums.iis.net/p/1149787/1917288.aspx

这篇关于HTTP请求的制造&gt内容长度;身体尺寸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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