ArcObjects Library Reference  (Server)    

esriServer_IGISServerConnection_Example

[Visual Basic 6.0]

The following VB code shows how to use the IGISServerConnection interface to connect to an ArcGIS Server

running on a machine called "melange", and print out the names and types of the server object configurations

configured on the server:

   Dim pGISServerConnection As IGISServerConnection2
  Set pGISServerConnection = New GISServerConnection
  pGISServerConnection.Connect "melange"
 
  Dim pServerObjectManager As IServerObjectManager
  Set pServerObjectManager = pGISServerConnection.ServerObjectManager
 
  Dim pEnumConfigInfo As IEnumServerObjectConfigurationInfo
  Set pEnumConfigInfo = pServerObjectManager.GetConfigurationInfos
 
  Dim pConfigInfo As IServerObjectConfigurationInfo
  Set pConfigInfo = pEnumConfigInfo.Next
  Do Until pConfigInfo Is Nothing
    Debug.Print pConfigInfo.Name & ": " & pConfigInfo.TypeName
    Set pConfigInfo = pEnumConfigInfo.Next
  Loop

The above code assumes that ArcObjects have been installed on the machine which is running the VB

application (by installing the ArcGIS Server Container, ArcEngine, or ArcGIS Desktop).


[Visual Basic .NET]
Public Sub GISServerConnection()
'The following VB code shows how to use the IGISServerConnection interface to connect 
'to an ArcGIS Serverrunning on a machine called "melange", and print out the names and 
'types of the server object configurationsconfigured on the server:
Dim gisServerConnection As IGISServerConnection2 = New GISServerConnection
gisServerConnection.Connect("melange")
Dim serverObjectManager As IServerObjectManager = gisServerConnection.ServerObjectManager
Dim enumConfigInfo As IEnumServerObjectConfigurationInfo = serverObjectManager.GetConfigurationInfos
Dim configInfo As IServerObjectConfigurationInfo = enumConfigInfo.Next
Do Until configInfo Is Nothing
    Debug.Print(configInfo.Name & ": " & configInfo.TypeName)
    configInfo = enumConfigInfo.Next
Loop
End Sub

[C#]
public void GISServerConnection()
{
//The following VB code shows how to use the IGISServerConnection interface to connect 
//to an ArcGIS Serverrunning on a machine called "melange", and print out the names and 
//types of the server object configurationsconfigured on the server:
IGISServerConnection2 gisServerConnection = new GISServerConnection();
gisServerConnection.Connect("melange");
IServerObjectManager serverObjectManager = gisServerConnection.ServerObjectManager;
IEnumServerObjectConfigurationInfo enumConfigInfo = serverObjectManager.GetConfigurationInfos;
IServerObjectConfigurationInfo configInfo = enumConfigInfo.Next();
while ( configInfo != null)
{ 
Debug.Print(configInfo.Name + ": " + configInfo.TypeName); 
configInfo = enumConfigInfo.Next();
}
}

[C++]
No example is available for C++. To view a Visual Basic 6.0, Visual Basic .NET, or a C# example, click the Language Filter button Language Filter in the upper-left corner of the page.