ChannelDispatcher.Detach(ServiceHostBase) Método
Definição
Desanexa o host de serviço do dispatcher do canal.Detaches the service host from the channel dispatcher.
protected:
override void Detach(System::ServiceModel::ServiceHostBase ^ host);
protected override void Detach (System.ServiceModel.ServiceHostBase host);
override this.Detach : System.ServiceModel.ServiceHostBase -> unit
Protected Overrides Sub Detach (host As ServiceHostBase)
Parâmetros
- host
- ServiceHostBase
O ServiceHostBase do serviço.The ServiceHostBase for the service.
Exceções
host é null.host is null.
host não é o host do dispatcher do canal.host is not the host of the channel dispatcher.
- ou --or-
O objeto de comunicação está em um estado Opening ou Opened.The communication object is in an Opening or Opened state.
O objeto de comunicação está em um estado Closing ou Closed.The communication object is in a Closing or Closed state.
Exemplos
Uri baseAddress = new Uri("http://localhost:8001/Simple");
ServiceHost serviceHost = new ServiceHost(typeof(CalculatorService), baseAddress);
serviceHost.AddServiceEndpoint(
typeof(ICalculator),
new WSHttpBinding(),
"CalculatorServiceObject");
serviceHost.Open();
IChannelListener icl = serviceHost.ChannelDispatchers[0].Listener;
ChannelDispatcher dispatcher = new ChannelDispatcher(icl);
dispatcher.CloseInput();
Dim baseAddress As New Uri("http://localhost:8001/Simple")
Dim serviceHost As New ServiceHost(GetType(CalculatorService), baseAddress)
serviceHost.AddServiceEndpoint(GetType(ICalculator), New WSHttpBinding(), "CalculatorServiceObject")
serviceHost.Open()
Dim icl As IChannelListener = serviceHost.ChannelDispatchers(0).Listener
Dim dispatcher As New ChannelDispatcher(icl)
dispatcher.CloseInput()
Comentários
O ServiceHostBase só pode ser desanexado quando a instância do ChannelDispatcher está no Created estado, pois esse é o único Estado que é mutável e não Descartado.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.
Define o ServiceHostBase associado ao dispatcher do canal como null .Sets the ServiceHostBase associated with the channel dispatcher to null.