ChannelManagerService 构造函数
定义
初始化 ChannelManagerService 类的新实例。Initializes a new instance of the ChannelManagerService class.
重载
| ChannelManagerService() |
初始化 ChannelManagerService 类的新实例。Initializes a new instance of the ChannelManagerService class. |
| ChannelManagerService(IList<ServiceEndpoint>) |
初始化 ChannelManagerService 类的新实例。Initializes a new instance of the ChannelManagerService class. |
| ChannelManagerService(NameValueCollection) |
初始化 ChannelManagerService 类的新实例。Initializes a new instance of the ChannelManagerService class. |
| ChannelManagerService(ChannelPoolSettings) |
初始化 ChannelManagerService 类的新实例。Initializes a new instance of the ChannelManagerService class. |
| ChannelManagerService(ChannelPoolSettings, IList<ServiceEndpoint>) |
初始化 ChannelManagerService 类的新实例。Initializes a new instance of the ChannelManagerService class. |
ChannelManagerService()
初始化 ChannelManagerService 类的新实例。Initializes a new instance of the ChannelManagerService class.
public:
ChannelManagerService();
public ChannelManagerService ();
Public Sub New ()
示例
下面的示例演示如何创建 ChannelManagerService 对象的新实例。The following example demonstrates how to create a new instance of the ChannelManagerService object. 此示例从 SequentialWorkflowService SDK 示例改写而来。This example was adapted from the SequentialWorkflowService SDK sample.
// Add ChannelManager.
ChannelManagerService channelmgr = new ChannelManagerService();
workflowRuntime.AddService(channelmgr);
' Add ChannelManager.
Dim channelmgr As New ChannelManagerService()
workflowRuntime.AddService(channelmgr)
适用于
ChannelManagerService(IList<ServiceEndpoint>)
初始化 ChannelManagerService 类的新实例。Initializes a new instance of the ChannelManagerService class.
public:
ChannelManagerService(System::Collections::Generic::IList<System::ServiceModel::Description::ServiceEndpoint ^> ^ endpoints);
public ChannelManagerService (System.Collections.Generic.IList<System.ServiceModel.Description.ServiceEndpoint> endpoints);
new System.Workflow.Runtime.Hosting.ChannelManagerService : System.Collections.Generic.IList<System.ServiceModel.Description.ServiceEndpoint> -> System.Workflow.Runtime.Hosting.ChannelManagerService
Public Sub New (endpoints As IList(Of ServiceEndpoint))
参数
- endpoints
- IList<ServiceEndpoint>
服务终结点的集合。A collection of service endpoints.
示例
下面的示例演示如何创建 ChannelManagerService 对象的新实例。The following example demonstrates how to create a new instance of the ChannelManagerService object. 此示例从 WorkflowServiceUtility SDK 示例改写而来。This example was adapted from the WorkflowServiceUtility SDK sample.
contextFileName = localServiceHost.Description.ServiceType.Name + contextFileExtension;
// add local client endpoints
workflowRuntime = this.Description.Behaviors.Find<WorkflowRuntimeBehavior>().WorkflowRuntime;
workflowRuntime.AddService(new ChannelManagerService(localServiceHost.ClientEndpoints));
localServiceHost.Open();
contextFileName = localServiceHost.Description.ServiceType.Name & contextFileExtension
' add local client endpoints.
workflowRuntime = Me.Description.Behaviors.Find(Of WorkflowRuntimeBehavior)().WorkflowRuntime
workflowRuntime.AddService(New ChannelManagerService(localServiceHost.ClientEndpoints))
localServiceHost.Open()
注解
ChannelManagerService 类的实例通常由运行库使用配置文件创建。Instances of the ChannelManagerService class are usually created by the runtime using configuration files.
在服务构造函数中定义的终结点将用于创建与 ChannelToken 中的配置名称相匹配的通道。The endpoints defined in the service's constructor will be used to create channels that match the configuration name in the ChannelToken. 配置中定义的终结点优先于代码中定义的终结点,因此如果通过代码添加的服务终结点与配置文件中的服务终结点具有相同的名称和协定类型,则不会使用代码中定义的终结点。The endpoints defined in the configuration take precedence over the endpoints defined in code, so if a service endpoint added through code has the same name and contract type as one in the configuration file, then the endpoint defined in code will not be used.
适用于
ChannelManagerService(NameValueCollection)
初始化 ChannelManagerService 类的新实例。Initializes a new instance of the ChannelManagerService class.
public:
ChannelManagerService(System::Collections::Specialized::NameValueCollection ^ parameters);
public ChannelManagerService (System.Collections.Specialized.NameValueCollection parameters);
new System.Workflow.Runtime.Hosting.ChannelManagerService : System.Collections.Specialized.NameValueCollection -> System.Workflow.Runtime.Hosting.ChannelManagerService
Public Sub New (parameters As NameValueCollection)
参数
- parameters
- NameValueCollection
服务的配置参数。Configuration parameters for the service.
示例
下面的示例演示如何创建 ChannelManagerService 对象的新实例。The following example demonstrates how to create a new instance of the ChannelManagerService object.
NameValueCollection parameters = new NameValueCollection();
parameters.Add("idleTimeout", TimeSpan.FromMinutes(10).ToString());
parameters.Add("leaseTimeout", TimeSpan.FromMinutes(1).ToString());
parameters.Add("maxIdleChannelsPerEndpoint", "10");
ChannelManagerService service = new ChannelManagerService(parameters);
Dim parameters As New NameValueCollection()
With parameters
.Add("idleTimeout", TimeSpan.FromMinutes(10).ToString())
.Add("leaseTimeout", TimeSpan.FromMinutes(1).ToString())
.Add("maxIdleChannelsPerEndpoint", "10")
End With
Dim service As New ChannelManagerService(parameters)
注解
支持以下参数:The following parameters are supported:
idleTimeout: TimeSpan 缓存的通道可处于空闲状态的最大值。idleTimeout: The maximum TimeSpan that a cached channel can be idle.leaseTimeout:缓存通道可以由 TimeSpan 签出或使用的最大 SendActivity。leaseTimeout: The maximum TimeSpan that a cached channel can be checked out or in use by a SendActivity.maxIdleChannelsPerEndpoint:与可随时缓存的单个终结点匹配的空闲通道的最大数量。maxIdleChannelsPerEndpoint: The maximum number of idle channels matching a single endpoint that can be cached at any point.
ChannelManagerService 类的实例通常由运行库使用配置文件创建。Instances of the ChannelManagerService class are usually created by the runtime using configuration files.
适用于
ChannelManagerService(ChannelPoolSettings)
初始化 ChannelManagerService 类的新实例。Initializes a new instance of the ChannelManagerService class.
public:
ChannelManagerService(System::ServiceModel::Channels::ChannelPoolSettings ^ settings);
public ChannelManagerService (System.ServiceModel.Channels.ChannelPoolSettings settings);
new System.Workflow.Runtime.Hosting.ChannelManagerService : System.ServiceModel.Channels.ChannelPoolSettings -> System.Workflow.Runtime.Hosting.ChannelManagerService
Public Sub New (settings As ChannelPoolSettings)
参数
- settings
- ChannelPoolSettings
此服务所管理的通道池配额设置。Settings for quotas for the pool of channels managed by this service.
示例
下面的示例演示如何创建 ChannelManagerService 对象的新实例。The following example demonstrates how to create a new instance of the ChannelManagerService object.
ChannelPoolSettings settings = new ChannelPoolSettings();
settings.IdleTimeout = TimeSpan.FromMinutes(10);
settings.LeaseTimeout = TimeSpan.FromMinutes(1);
settings.MaxOutboundChannelsPerEndpoint = 10;
ChannelManagerService service = new ChannelManagerService(settings);
Dim settings As New ChannelPoolSettings()
With settings
.IdleTimeout = TimeSpan.FromMinutes(10)
.LeaseTimeout = TimeSpan.FromMinutes(1)
.MaxOutboundChannelsPerEndpoint = 10
End With
Dim service As New ChannelManagerService(settings)
适用于
ChannelManagerService(ChannelPoolSettings, IList<ServiceEndpoint>)
初始化 ChannelManagerService 类的新实例。Initializes a new instance of the ChannelManagerService class.
public:
ChannelManagerService(System::ServiceModel::Channels::ChannelPoolSettings ^ settings, System::Collections::Generic::IList<System::ServiceModel::Description::ServiceEndpoint ^> ^ endpoints);
public ChannelManagerService (System.ServiceModel.Channels.ChannelPoolSettings settings, System.Collections.Generic.IList<System.ServiceModel.Description.ServiceEndpoint> endpoints);
new System.Workflow.Runtime.Hosting.ChannelManagerService : System.ServiceModel.Channels.ChannelPoolSettings * System.Collections.Generic.IList<System.ServiceModel.Description.ServiceEndpoint> -> System.Workflow.Runtime.Hosting.ChannelManagerService
Public Sub New (settings As ChannelPoolSettings, endpoints As IList(Of ServiceEndpoint))
参数
- settings
- ChannelPoolSettings
此服务所管理的通道池配额设置。Settings for quotas for the pool of channels managed by this service.
- endpoints
- IList<ServiceEndpoint>
服务终结点的集合。A collection of service endpoints.
示例
下面的示例演示如何创建 ChannelManagerService 对象的新实例。The following example demonstrates how to create a new instance of the ChannelManagerService object.
ChannelPoolSettings settings = new ChannelPoolSettings();
settings.IdleTimeout = TimeSpan.FromMinutes(10);
settings.LeaseTimeout = TimeSpan.FromMinutes(1);
settings.MaxOutboundChannelsPerEndpoint = 10;
IList<ServiceEndpoint> endpoints = new List<ServiceEndpoint>();
endpoints.Add(new ServiceEndpoint(contractDescription));
ChannelManagerService service = new ChannelManagerService(settings, endpoints);
Dim settings As New ChannelPoolSettings()
With settings
settings.IdleTimeout = TimeSpan.FromMinutes(10)
settings.LeaseTimeout = TimeSpan.FromMinutes(1)
settings.MaxOutboundChannelsPerEndpoint = 10
End With
Dim endpoints As IList(Of ServiceEndpoint) = New List(Of ServiceEndpoint)()
endpoints.Add(New ServiceEndpoint(contractDescription))
Dim service As New ChannelManagerService(settings, endpoints)