ChannelManagerService 构造函数

定义

初始化 ChannelManagerService 类的新实例。

重载

ChannelManagerService()

初始化 ChannelManagerService 类的新实例。

ChannelManagerService(IList<ServiceEndpoint>)

初始化 ChannelManagerService 类的新实例。

ChannelManagerService(NameValueCollection)

初始化 ChannelManagerService 类的新实例。

ChannelManagerService(ChannelPoolSettings)

初始化 ChannelManagerService 类的新实例。

ChannelManagerService(ChannelPoolSettings, IList<ServiceEndpoint>)

初始化 ChannelManagerService 类的新实例。

ChannelManagerService()

初始化 ChannelManagerService 类的新实例。

public:
 ChannelManagerService();
public ChannelManagerService ();
Public Sub New ()

示例

下面的示例演示如何创建 ChannelManagerService 对象的新实例。 此示例从 SequentialWorkflowService SDK 示例改写而来。

// Add ChannelManager.
ChannelManagerService channelmgr = new ChannelManagerService();
workflowRuntime.AddService(channelmgr);
' Add ChannelManager.
Dim channelmgr As New ChannelManagerService()
workflowRuntime.AddService(channelmgr)

适用于

ChannelManagerService(IList<ServiceEndpoint>)

初始化 ChannelManagerService 类的新实例。

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>

服务终结点的集合。

示例

下面的示例演示如何创建 ChannelManagerService 对象的新实例。 此示例从 WorkflowServiceUtility SDK 示例改写而来。

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 类的实例通常由运行库使用配置文件创建。

在服务构造函数中定义的终结点将用于创建与 ChannelToken 中的配置名称相匹配的通道。 配置中定义的终结点优先于代码中定义的终结点,因此如果通过代码添加的服务终结点与配置文件中的服务终结点具有相同的名称和协定类型,则不会使用代码中定义的终结点。

适用于

ChannelManagerService(NameValueCollection)

初始化 ChannelManagerService 类的新实例。

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

服务的配置参数。

示例

下面的示例演示如何创建 ChannelManagerService 对象的新实例。

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)

注解

支持以下参数:

  • idleTimeout:缓存通道可以空闲的最大值 TimeSpan

  • leaseTimeout:缓存通道可以由 TimeSpan 签出或使用的最大 SendActivity

  • maxIdleChannelsPerEndpoint:与单个终结点匹配的空闲通道的最大数目,该终结点随时可缓存。

ChannelManagerService 类的实例通常由运行库使用配置文件创建。

适用于

ChannelManagerService(ChannelPoolSettings)

初始化 ChannelManagerService 类的新实例。

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

此服务所管理的通道池配额设置。

示例

下面的示例演示如何创建 ChannelManagerService 对象的新实例。

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 类的新实例。

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

此服务所管理的通道池配额设置。

endpoints
IList<ServiceEndpoint>

服务终结点的集合。

示例

下面的示例演示如何创建 ChannelManagerService 对象的新实例。

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)

适用于