How to fix Server Error in '/GpsGateServer' Application

SYMPTOM

You get an error similar to the following when browsing the Device Type page in SiteAdmin or when saving an Application in SiteAdmin

"Server Error in '/GpsGateServer' Application.

Operation is not valid due to the current state of the object.

Stack Trace:
System.Web.HttpValueCollection.ThrowIfMaxHttpCollectionKeysExceeded()
"

CAUSE

This error occurs because of the amount of form fields that your device type contains. A limit of 1000 form fields was added in an ASP.NET security fix recently released by Microsoft.

See here for more info about the security fix.

SOLUTION

You can raise the limit by adding an application setting in the GpsGateServer/IIS/Web.config file.

<appSettings>
...
<add key="aspnet:MaxHttpCollectionKeys" value="5000"/>
</appSettings>