Partager via


ChannelDispatcher.Host Propriété

Définition

Obtient l'hôte pour le service associé au répartiteur.

public:
 virtual property System::ServiceModel::ServiceHostBase ^ Host { System::ServiceModel::ServiceHostBase ^ get(); };
public override System.ServiceModel.ServiceHostBase Host { get; }
member this.Host : System.ServiceModel.ServiceHostBase
Public Overrides ReadOnly Property Host As ServiceHostBase

Valeur de propriété

ServiceHostBase pour le service associé au répartiteur.

Exemples

Uri baseAddress = new Uri("http://localhost:8001/Simple");
ServiceHost serviceHost = new ServiceHost(typeof(CalculatorService), baseAddress);

serviceHost.AddServiceEndpoint(
    typeof(ICalculator),
    new WSHttpBinding(),
    "CalculatorServiceObject");

serviceHost.Open();

ChannelDispatcher dispatcher = (ChannelDispatcher)serviceHost.ChannelDispatchers[0];
ServiceHostBase hostBase = dispatcher.Host;
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 dispatcher As ChannelDispatcher = CType(serviceHost.ChannelDispatchers(0), ChannelDispatcher)
Dim hostBase As ServiceHostBase = dispatcher.Host

Remarques

Chaque objet ServiceHost peut avoir de nombreux objets ChannelDispatcher, chacun étant associé à un IChannelListener différent pour ce service.

S’applique à