ChannelDispatcher 建構函式
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
初始化 ChannelDispatcher 類別的新執行個體。
多載
ChannelDispatcher(IChannelListener)
初始化 ChannelDispatcher 類別的新執行個體。
public:
ChannelDispatcher(System::ServiceModel::Channels::IChannelListener ^ listener);
public ChannelDispatcher (System.ServiceModel.Channels.IChannelListener listener);
new System.ServiceModel.Dispatcher.ChannelDispatcher : System.ServiceModel.Channels.IChannelListener -> System.ServiceModel.Dispatcher.ChannelDispatcher
Public Sub New (listener As IChannelListener)
參數
- listener
- IChannelListener
通道發送器的 IChannelListener。
例外狀況
listener
為 null
。
範例
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);
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)
備註
從提供的接聽程式 (Listener) 使用系統提供的預設逾時,初始化 ChannelDispatcher 類別的新執行個體。
適用於
ChannelDispatcher(IChannelListener, String)
初始化 ChannelDispatcher 類別的新執行個體。
public:
ChannelDispatcher(System::ServiceModel::Channels::IChannelListener ^ listener, System::String ^ bindingName);
public ChannelDispatcher (System.ServiceModel.Channels.IChannelListener listener, string bindingName);
new System.ServiceModel.Dispatcher.ChannelDispatcher : System.ServiceModel.Channels.IChannelListener * string -> System.ServiceModel.Dispatcher.ChannelDispatcher
Public Sub New (listener As IChannelListener, bindingName As String)
參數
- listener
- IChannelListener
通道發送器的 IChannelListener。
- bindingName
- String
用於設定服務的繫結名稱。
例外狀況
listener
為 null
。
範例
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, "MyTestBinding");
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, "MyTestBinding")
備註
從提供的接聽程式和繫結使用系統提供的預設逾時,初始化 ChannelDispatcher 類別的新執行個體。
適用於
ChannelDispatcher(IChannelListener, String, IDefaultCommunicationTimeouts)
初始化 ChannelDispatcher 類別的新執行個體。
public:
ChannelDispatcher(System::ServiceModel::Channels::IChannelListener ^ listener, System::String ^ bindingName, System::ServiceModel::IDefaultCommunicationTimeouts ^ timeouts);
public ChannelDispatcher (System.ServiceModel.Channels.IChannelListener listener, string bindingName, System.ServiceModel.IDefaultCommunicationTimeouts timeouts);
new System.ServiceModel.Dispatcher.ChannelDispatcher : System.ServiceModel.Channels.IChannelListener * string * System.ServiceModel.IDefaultCommunicationTimeouts -> System.ServiceModel.Dispatcher.ChannelDispatcher
Public Sub New (listener As IChannelListener, bindingName As String, timeouts As IDefaultCommunicationTimeouts)
參數
- listener
- IChannelListener
服務的 IChannelListener。
- bindingName
- String
用於設定服務的繫結名稱。
- timeouts
- IDefaultCommunicationTimeouts
例外狀況
listener
為 null
。
範例
Uri baseAddress = new Uri("http://localhost:8001/Simple");
ServiceHost serviceHost = new ServiceHost(typeof(CalculatorService), baseAddress);
WSHttpBinding binding = new WSHttpBinding();
serviceHost.AddServiceEndpoint(
typeof(ICalculator),
binding,
"CalculatorServiceObject");
serviceHost.Open();
IChannelListener icl = serviceHost.ChannelDispatchers[0].Listener;
ChannelDispatcher dispatcher = new ChannelDispatcher(icl, "MyTestBinding", binding);
Dim baseAddress As New Uri("http://localhost:8001/Simple")
Dim serviceHost As New ServiceHost(GetType(CalculatorService), baseAddress)
Dim binding As New WSHttpBinding()
serviceHost.AddServiceEndpoint(GetType(ICalculator), binding, "CalculatorServiceObject")
serviceHost.Open()
Dim icl As IChannelListener = serviceHost.ChannelDispatchers(0).Listener
Dim dispatcher As New ChannelDispatcher(icl, "MyTestBinding", binding)
備註
從提供的接聽程式和繫結使用指定的預設逾時,初始化 ChannelDispatcher 類別的新執行個體。