drspatial

ClassFactory cannot supply requested class error with AGS Spatial Ref

Discussion created by drspatial on Jun 13, 2012
Latest reply on Aug 16, 2017 by DCSlatunn
Hi Everybody,
I am writing a .NET WCF 3.5 REST service and I am getting a weird error when trying to create a projected coordinate system:

[System.Runtime.InteropServices.COMException] = {"ClassFactory cannot supply requested class (Exception from HRESULT: 0x80040111 (CLASS_E_CLASSNOTAVAILABLE))"}

The problem error exists when I call the following line: inSpatRef = inSpatRefFact.CreateProjectedCoordinateSystem(102100);

ISpatialReferenceFactory2 inSpatRefFact = sc.CreateObject("esriGeometry.SpatialReferenceEnvironment") as ISpatialReferenceFactory2;
ISpatialReference inSpatRef = sc.CreateObject("esriGeometry.ProjectedCoordinateSystem") as ISpatialReference;
inSpatRef = inSpatRefFact.CreateProjectedCoordinateSystem(102100);

I am using the AGSServerConnection:

agsconn = new ESRI.ArcGIS.ADF.Connection.AGS.AGSServerConnection(System.Configuration.ConfigurationManager.AppSettings["AgsServer"], id);
agsconn.Connect();
if (!agsconn.IsConnected)
{
agsconn.Dispose();
return "Server Connection Failed";
}

ESRI.ArcGIS.Server.IServerObjectManager som = agsconn.ServerObjectManager;
sc = som.CreateServerContext("MyFolder/MyMapService", "MapServer");

Any ideas?

Thanks!

Ian

Outcomes