We have a very strange problem that we still cannot diagnose. Our application has a number of specific ASP.NET MVC actions that fail due to the lack of the required parameter:
The parameters dictionary contains a null entry for parameter 'myVariable' of non-nullable type... etc
Each of them is a kind of HTTP POST, and therefore we expect to see the form data. In some cases, there must be more than a dozen variables.
We use ELMAH to collect errors in a web application, and with this tool you can usually see the actual form data that is published during a request that fails. However, in these specific errprs, when there should be several variables, the whole form is missing!
We simply cannot reproduce this on demand. However, with the amount of traffic in our application, we see these errors several dozen times a day. Users also cannot reproduce the error, and the repetition of the same action in the web browser is performed a second time.
We are also not 100% sure where the data is lost. Is it in a web browser? Inside the IIS pipeline? Or is it an ASP.NET MVC that resets it? Totally unsure.
If someone can help us fix the problem and / or diagnose this problem, we will be very grateful.
Update 1: We found that the length of the content indicated in the HTTP headers is of a size that assumes that there is some content in the request. However, the collection of forms on request is empty (according to ELMAH). Therefore, we have added several additional protocols to track the actual length of the received content and the content itself.
Update 2: We found that although the CONTENT_LENGTH HTTP header is the correct size (for similar requests), the content itself is missing. The stream contains 0 bytes.
We can also narrow down the problem to Internet Explorer, we cannot make it work with other browsers.
We could sometimes recreate the problem by invoking multiple overlapping AJAX requests in the browser, and then either updating or redirecting. It is almost as if Internet Explorer closes the connection before writing the stream buffer completely.
We were unable to trace this with Fiddler. Using Fiddler, it seems that it is impossible to recreate a specific situation.
Update 3: Everything we saw can be explained as follows: Why doesn't Internet Explorer send the body of an HTTP message after an Ajax call after a failure?