I'm stuck with a problem that causes my WebApplication to crash on a regular bases. A Client (Browser) get the HTTP status code 500 after making some (more than 1) requests to the server. I turned on the IIS Failed Request Tracing and discoverd, that the request exceeded the max request limit:
Maximum request length exceeded
I looked at the hidden __VIEWSTATE
field and found, that it contains some information I expected and a cryptic (probably base64 encoded) serialized object with 49,500 characters. I didn't know, why this was so large and Checked my Session and ViewState objectes in my code behind. But nothing was suspicious.
Since I'm displaying 2 ASP.NET Charts and a large data table (5k rows and aprox 20 cols) I went into my Web.Config file and increased my request limit to
</system.web>
<httpRuntime maxRequestLength="4194304"/>
</system.web>
That was kinda successfull, meaning that the server survived one more request bevore then crashing with an OutOfMemoryException
, claiming there is no more memory available.
By now, I'm pretty sure that there are some (and with some I mean tons) unwanted, unneccesary, most likely unused objects stored. (nice way of describing a memory leak ;) ).
But at this point, I am lost. Is there any way I can look into the ViewState before its being serialized and check, what kind of objects are referenced there? Can I clear/delete/flush the ViewState/Session/whatever is responsible for this in order to have a clean serialized ViewState that does not exceed the default limit?