CommunicationObject.Open Method

Definition

Causes a communication object to transition from the created state into the opened state.

Overloads

Open()

Causes a communication object to transition from the created state into the opened state.

Open(TimeSpan)

Causes a communication object to transition from the created state into the opened state within a specified interval of time.

Remarks

When called, the Open method causes a CommunicationObject to enter into the Opening state and calls OnOpening, Open, and OnOpened. The OnOpened method completes the Open method by setting the state of the object to the Opened state.

Open()

Causes a communication object to transition from the created state into the opened state.

public:
 virtual void Open();
public void Open ();
abstract member Open : unit -> unit
override this.Open : unit -> unit
Public Sub Open ()

Implements

Exceptions

The communication object is not in a Opened or Opening state and cannot be modified.

The communication object is in a Closing or Closed state and cannot be modified.

The communication object is in a Faulted state and cannot be modified.

The default interval of time that was allotted for the operation was exceeded before the operation was completed.

Remarks

When a CommunicationObject is instantiated, it begins in the Created state. In the Created state, the object can be configured (for example, properties can be set, or events can be registered), but it is not yet usable to send or receive messages. When called, the Open method causes a CommunicationObject to enter into the Opening state and calls OnOpening, Open, and OnOpened. The OnOpened method completes the Open method by setting the state of the object to the Opened state.

In the

Opened state, the CommunicationObject is usable (for example, messages can be received), but it is no longer configurable.

There is also an asynchronous version of the open method that is initiated by calling OnBeginOpen(TimeSpan, AsyncCallback, Object) and completed by calling EndOpen.

Credentials Capture with Windows Authentication

When using Windows authentication, credentials used by the service are based on the current context thread. The credentials are obtained when the Open method is called.

Note

For asynchronous calls, credentials are captured when the BeginOpen is invoked. However, the actual credentials cannot be guaranteed. That is, the credentials of the caller may be switched to another identity. For more information, see Message Security with a Windows Client.

See also

Open(TimeSpan)

Causes a communication object to transition from the created state into the opened state within a specified interval of time.

public:
 virtual void Open(TimeSpan timeout);
public void Open (TimeSpan timeout);
abstract member Open : TimeSpan -> unit
override this.Open : TimeSpan -> unit
Public Sub Open (timeout As TimeSpan)

Parameters

timeout
TimeSpan

The TimeSpan that specifies how long the open operation has to complete before timing out.

Implements

Exceptions

The communication object is not in a Opened or Opening state and cannot be modified.

The communication object is in a Closing or Closed state and cannot be modified.

The communication object is in a Faulted state and cannot be modified.

The default interval of time that was allotted for the operation was exceeded before the operation was completed.

Remarks

When a CommunicationObject is instantiated, it begins in the Created state. In the Created state, the object can be configured (for example, properties can be set, or events can be registered), but it is not yet usable to send or receive messages. When called, the Open method causes a CommunicationObject to enter into the Opening state and calls OnOpening, Open, and OnOpened. The OnOpened method completes the Open method by setting the state of the object to the Opened state.

In the

Opened state, the CommunicationObject is usable (for example, messages can be received), but it is no longer configurable.

There is also an asynchronous version of the open method that is initiated by calling BeginOpen and completed by calling EndOpen.

Applies to