ChannelDispatcher.ServiceThrottle 属性

定义

获取或设置与通道调度程序关联的服务的服务控制器。

public:
 property System::ServiceModel::Dispatcher::ServiceThrottle ^ ServiceThrottle { System::ServiceModel::Dispatcher::ServiceThrottle ^ get(); void set(System::ServiceModel::Dispatcher::ServiceThrottle ^ value); };
public System.ServiceModel.Dispatcher.ServiceThrottle ServiceThrottle { get; set; }
member this.ServiceThrottle : System.ServiceModel.Dispatcher.ServiceThrottle with get, set
Public Property ServiceThrottle As ServiceThrottle

属性值

ServiceThrottle 对象。

例外

通信对象处于 OpeningOpened 状态。

通信对象处于 ClosingClosed 状态。

通信对象处于 Faulted 状态。

示例

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);
ServiceThrottle throttle = dispatcher.ServiceThrottle;
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)
Dim throttle As ServiceThrottle = dispatcher.ServiceThrottle

注解

这提供对用于优化服务的可用性和性能的控件的访问。

只有当 ChannelDispatcher 的实例处于 Created 状态时才可以设置此属性,因为该状态是唯一一个可变且不被释放的状态。

适用于