Search code examples
c#arcgis

Unable to access ArcGIS ServerObjectManager


I have a C# plugin for ArcGIS, and I'm trying to access ServerObjectManager off of an AGSServerConnection but it's coming out as null.

The block of code is:

string serverMachineName = adfMap.PrimaryMapResourceInstance.DataSource.DataSourceDefinition;
Identity adfIdentity = new Identity("Administrator", "password", "computername");
AGSServerConnection agsServerConnection = new AGSServerConnection(serverMachineName, adfIdentity, true);
IServerObjectManager serverObjectManager = agsServerConnection.ServerObjectManager;
IServerContext serverContext = serverObjectManager.CreateServerContext("TemporaryContext", "MapServer");

serverMachineName is something along the lines of http://computername/arcgis/services. The Administrator account is an administrator on the system, as well as a member of agsadmin and agsusers (just in case). The connection line succeeds. serverObjectManager is null at this point, so the subsequent call to create a server context fails.

Any advice?


Solution

  • Looks like I shouldn't have taken a non-error on the connection for granted. Throwing in a check to see if it was actually connected showed that it really wasn't.