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

554
1
06-14-2010 04:55 AM
NathanielWingfield
New Contributor II
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.
0 Kudos
1 Reply
NathanielWingfield
New Contributor II
The solution is: use an MXD-based map service. MSD-based map services are apparently lacking in the ArcObjects department. http://forums.esri.com/Thread.asp?c=158&f=2272&t=284524#883049
0 Kudos