ReplicationConnection Constructor (DirectoryContext, String, DirectoryServer, ActiveDirectoryTransportType)


Initializes a new instance of the ReplicationConnection class, using the specified context, name, source server, and transport type.

Namespace:   System.DirectoryServices.ActiveDirectory
Assembly:  System.DirectoryServices (in System.DirectoryServices.dll)

public ReplicationConnection(
	DirectoryContext context,
	string name,
	DirectoryServer sourceServer,
	ActiveDirectoryTransportType transport


Type: System.DirectoryServices.ActiveDirectory.DirectoryContext

A DirectoryContext object that contains the target and credentials to establish a replication connection with.

Type: System.String

The user-defined name of the connection.

Type: System.DirectoryServices.ActiveDirectory.DirectoryServer

A DirectoryServer object that identifies the source server of the connection.

Type: System.DirectoryServices.ActiveDirectory.ActiveDirectoryTransportType

One of the ActiveDirectoryTransportType members that specifies the transport type of the connection.

Exception Condition

A call to the underlying directory service resulted in an error.


The target server is either busy or unavailable.


This exception will occur for any one of the following reasons:

  • The target of the context parameter is not a domain controller or AD LDS instance.

  • sourceServer is invalid or an empty string.

  • The target specified in the context parameter does not match the server type specified in the sourceServer parameter. The servers must both be either domain controllers or AD LDS instances.

  • The servers specified in the context and sourceServer parameters are domain controllers, but are not in the same forest.

  • The servers specified in the context and sourceServer parameters are AD LDS instances, but do not belong to the same configuration set.


context or sourceServer is null.


The credentials that were supplied are not valid.


transport is not a valid ActiveDirectoryTransportType value.


context is an AD LDS instance and transport is Smtp, which is not supported.

.NET Framework
Available since 2.0
Return to top