HTTP request content length> body size

I am running a website that has been running over the past few months on IIS 7.5 created using ASP.net MVC 3.0. From time to time, we encounter a problem when our AJAX POST request (launched through jQuery) fails because the sent JSON becomes truncated.

What we have discovered so far is that for the entire request, the "Content-Length" header of the request has more data than we actually get in the request.

We already set maxRequestLength to 51200 in our web.config, and I believe that the value of maxAllowedContentLength has a pretty big default value (we did not set this in our configuration). I also have an unsuccessful request with a "Content-Length" length of 7301 (bytes), but we managed to get a total of 2179 bytes. Therefore, I do not suspect that this will hit any limit.

The request header for the problematic request is as follows

  • Cache-control: no-cache
  • Connection: keep-alive
  • Pragma: no-cache
  • Content-Length: 7301
  • Content-Type: application / json; encoding = UTF-8;
  • Accept: application / json, text / javascript, /; d = 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

Any ideas?


Update . I was able to further isolate the problem from our code. We wrote an independent controller that takes a JSON string and simply deserializes it. In case of an error, it logs an error.

When I delete this controller in parallel to 150 parallel threads in a cycle of 50 requests, I get several crashes when the JSON that this controller receives is truncated. Now we are very focused on optimizing IIS and are reading more about the various parameters that may be related (we are currently working with default parameters in IIS).

I strongly feel that 150 simultaneous connections should not be a big problem, and I sincerely hope that by setting some parameters we can overcome this problem. As soon as we overcome this problem, we will share our conclusions.


* Update 2 (October 8) *: I further narrowed down the problem. I turned on the error log in IIS and found 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)" 

I find information about this error on the iis forums, but am not experimenting with suggestions (mutliple) yet. The following link may be a good starting point for finding more information about this.

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

+6
source share
1 answer

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

This is due to an error in Windows 2008 R2 where it makes asp.net sure that the client disconnected even when it did not. A fix for this is also available and is located at http://support.microsoft.com/kb/977453 . The fix is ​​already included with Windows 2008 R2 SP1 (found here ).

Although the fix worked for me in the same environment running Windows 2008 R2, it cannot be applied to Windows 2008 R2 SP1. Unfortunately, the problem can still be reproduced in environments running in SP1 and remains unresolved. I opened a new case on the IIS forums for this question at http://forums.iis.net/t/1192310.aspx and there will track it.

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

+1
source

Source: https://habr.com/ru/post/926615/


All Articles