ChannelDispatcherBase.Detach(ServiceHostBase) Method

Definition

When overridden in a derived class, detaches the channel dispatcher from a specific host.

protected:
 virtual void Detach(System::ServiceModel::ServiceHostBase ^ host);
protected virtual void Detach (System.ServiceModel.ServiceHostBase host);
abstract member Detach : System.ServiceModel.ServiceHostBase -> unit
override this.Detach : System.ServiceModel.ServiceHostBase -> unit
Protected Overridable Sub Detach (host As ServiceHostBase)

Parameters

Exceptions

host is null.

The communication object is in an Opening or Opened state or the host is already set.

The communication object is in a Closing or Closed state.

The communication object is in a Faulted state.

Remarks

The ServiceHostBase can only be detached when the instance of the ChannelDispatcher is in the Created state, as this is the only state that is both mutable and not disposed.

Should set the ServiceHostBase associated with the channel dispatcher to null.

ServiceHost calls this method when the ChannelDispatcherBase is removed from its ChannelDispatchers collection. This gives the ChannelDispatcherBase a chance to unhook events and inspect the ServiceHost.

Applies to