ArcGIS Pro 3.8 API Reference Guide
ArcGIS.Core.Data Namespace / ArcGISServerConnectionFile Class / ArcGISServerConnectionFile Constructor
A valid path to the ArcGIS Server connection file that ends with the .ags extension.
The name of the service to connect to.
Example

In This Topic
    ArcGISServerConnectionFile Constructor
    In This Topic
    Initializes a new instance of the ArcGISServerConnectionFile class.
    Syntax
    public ArcGISServerConnectionFile( 
       Uri path,
       string serviceName
    )
    Public Function New( _
       ByVal path As Uri, _
       ByVal serviceName As String _
    )

    Parameters

    path
    A valid path to the ArcGIS Server connection file that ends with the .ags extension.
    serviceName
    The name of the service to connect to.
    Exceptions
    ExceptionDescription
    path and/or serviceName is invalid.
    Example
    Connect to the ArcGISServer using a connection file
    {
      await QueuedTask.Run(() =>
      {
        Uri uriPath = new Uri("path\\to\\the\\ArcGISServerConnectionFile.ags");
        ArcGISServerConnectionFile arcGISServerConnectionFile = new ArcGISServerConnectionFile(uriPath, "FeatureServiceName");
    
        using (Geodatabase geodatabase = new Geodatabase(arcGISServerConnectionFile))
        {
          // Use the geodatabase.
        }
      });
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.8 or higher.
    See Also