System.IndexOutOfRangeException on a webfarm

Here is another issue that a customer had that I thought would be helpful to others.


The customer said they are getting Exception type: System.IndexOutOfRangeException every minute or so when accessing their web site.  The error looks like:

 System.IndexOutOfRangeException: Index was outside the bounds of the array.
  at System.Web.UI.WebControls.GridView.LoadControlState(Object savedState)
  at System.Web.UI.Control.LoadControlStateInternal(Object savedStateObj)
  at System.Web.UI.Page.LoadAllState()
  at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)


This is trying to load ViewState.  ViewState is not necessarily compatible between different versions of the runtime, including service pack changes. A given application, even if distributed in a web farm, must be running on the same exact runtime version on all servers.  This includes the bit-ness.  So they all need to be x86 or x64 as on the same version (Service Pack, etc).