VERIFIED SOLUTION i

Resolve Index out of Range error in MapXtreme .NET

Issue

When starting a MapXtreme .NET web application, the server returns this error:

Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Cause

The "index out of range" error occurs because the MapFactory is empty and there is no map to be used. The most common reason for this is a problem loading the workspace.

Resolution

UPDATED: September 13, 2017
Here are steps to resolve the issue:
  1. Ensure that the web.config contains the correct path to the workspace file.
  2. Open the workspace in WorkspaceManager on the server itself to make sure all the tables are available.
  3. Verify that the Map alias in the workspace file (.MWS) is the same as the Map alias specified in the MapControl.
  4. Make sure that the web application has the proper permission to access the workspace and all the associated tables and data.
Often, the ASP.NET user needs read and execute permissions on all the files needed for the workspace. If impersonation is used, check that the impersonated user has the proper rights.

If the issue is still not resolved, contact client support.
Environment Details
Product Affected: MapXtreme® .NET
Version: All supported versions
Operating System: Windows 7, 8, 10, 2008 with SP2, 2008 R2, 2012, 2012 R2