Unable to cast COM object (IMapServer --> IMapServerObjects)

Discussion created by nwingfield on Jun 14, 2010
Latest reply on Jun 15, 2010 by nwingfield
I have just deployed an AGS-based application to our web server. This app worked great in development, but after deployment to the server I get the following errror:

Unable to cast COM object of type 'System.__ComObject' to interface type 'ESRI.ArcGIS.Carto.IMapServerObjects'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{651521F3-AAFF-42B9-8C2D-1980625A13BF}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

The C# code generating this error is:

IServerContext context = som.CreateServerContext(ConfigurationManager.AppSettings["mapService"], "MapServer");
IMapServer mapServer = (IMapServer)context.ServerObject;
IMapServerObjects serverObjects = (IMapServerObjects)mapServer;

For some reason, the IMapServer instance cannot be casted to IMapServerObjects. This is becoming quite critical.