Few days ago I was asked to look into an issue. In our application we have created dynamic grids to show data from database. This ASPX page was Ajax enabled. Moreover all the rows of the grid were in edit mode ie. the normal controls like textbox,dropdowns etc were displayed in all the rows. This grid was Paginated. But for the past few days the paging was not working.
I executed the page and found that the page was generating an error 12031 with the following message
Sys.webForms.PageRequestManagerServerErrorException:An unknown error occurred while processing the request on the server .the status code returned from the server was:12031.
On my first round of analysis I found the issue with Viewstate. If the viewstate is large then connection is reset (ERROR_INTERNET_CONNECTION_RESET ). In local machine with less load this problem will not occur but as the load & network latency increases this error will come. Once this error is generated the general events of grid is not triggered. So advised my team to minimize the use of viewstate. It will help in to load the page faster & reduce the network traffic. I can increase the maxRequestlength value to allow more data but ideally i shouldn't increase that.
In the page tested by me a page with grid with 372 rows generated a viewstate of 4.2 mb. you can disable viewstate using EnableViewState="false" for the individual controls and for the entire page also.
With every post back this much of data is transferred back & fro & this will result in low response time.
The developer was saving all the data into viewstate in page load and from that the data was populated to the grid.
Better solution is to retrieve only the required data from database, minimize the use of viewstate, Viewstate can be compressed also. About all these I will update in another post.
After playing with Web services for so many years this was a tricky error which kept me thinking for few minutes.
Today when i tried to add WCF reference to my application it gave the following error,
Error
---------------------------
Microsoft Visual Studio
---------------------------
Failed to update Service Reference 'XXXBusiness.Reference'.
Error:The components required to enumerate Web references are not installed on this computer. Please re-install Visual Studio.(0x80004002)
What could have caused this error? Then i remembered there was a alert box from VS few hours ago which informed that some package was not loaded successfully and whether i wanted VS to stop loading that package in future.Without reading the full message I accidentally pressed "YES" I know mea cupla.
But i have to move forward ...
Now the solution
- Close all open Visual Studio instances
- Open the Command prompt available with Visual Studio and type devenv /resetskippkgs (You can directly type this to Run command or normal command prompt)
- Add reference to the Web service/WCF service
Now I am back in business :)