ChannelDispatcherBase.Detach Method (ServiceHostBase)


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

Namespace:   System.ServiceModel.Dispatcher
Assembly:  System.ServiceModel (in System.ServiceModel.dll)

protected virtual void Detach(
	ServiceHostBase host

Exception Condition

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.

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.

.NET Framework
Available since 3.0
Return to top