We have a very strange problem which we have yet to be able to diagnose. Our application has a number of specific ASP.NET MVC actions which fail because a required parameter is missing:
The parameters dictionary contains a null entry for parameter 'myVariable' of non-nullable type... etc
Each of these is some sort of HTTP POST, and thus we expect to see form data. In some cases there should be over a dozen variables.
We use ELMAH to collect errors in the web application, and via this tool you can typically see the actual form data which is posted during a request which fails. However in these specific errpr when there should be several variables the entire form is missing!
We simply cannot reproduce this on-demand. However with the volume of traffic in our application we see these errors several dozen times a day. Users cannot reproduce the error either, and trying the same action in the web browser works a second time.
We're also not 100% sure where the data is lost. Is it in the web browser? Inside the IIS pipeline? Or is it ASP.NET MVC which dumps it? Totally unsure.
If anyone can help us troubleshoot and/or diagnose this problem it would be greatly appreciated.
Update 1: We've discovered that the content length as specified in the HTTP Headers is of a size that suggests that there is some content in the request. However the forms collection on the request is empty (as per ELMAH). So we've added some additional logging to trace the actual length of the content received and the content itself.
Update 2: We have discovered that while the CONTENT_LENGTH HTTP Header is of the correct size (for a similar requests), the content itself is missing. The stream contains 0 bytes.
We've also be able to narrow down the problem to Internet Explorer, we can't seem to get it to happen with other browsers.
We've been able to sometimes recreate the problem by causing several overlapping AJAX requests in the browser, and then either refreshing or redirecting. It's almost as if Internet Explorer is closing the connection before completely writing out the stream buffer.
We have not been able to trace this with Fiddler. Using Fiddler, it appears it is impossible to recreate the specific situation.
Update 3: Everything we've seen can be explained by this: Why does Internet Explorer not send HTTP post body on Ajax call after failure?