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)
注解
使用系统提供的默认超时值,从提供的侦听器初始化 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 类的新实例。