แก้ไข

แชร์ผ่าน


ChannelManagerService Constructors

Definition

Initializes a new instance of the ChannelManagerService class.

Overloads

ChannelManagerService()

Initializes a new instance of the ChannelManagerService class.

ChannelManagerService(IList<ServiceEndpoint>)

Initializes a new instance of the ChannelManagerService class.

ChannelManagerService(NameValueCollection)

Initializes a new instance of the ChannelManagerService class.

ChannelManagerService(ChannelPoolSettings)

Initializes a new instance of the ChannelManagerService class.

ChannelManagerService(ChannelPoolSettings, IList<ServiceEndpoint>)

Initializes a new instance of the ChannelManagerService class.

ChannelManagerService()

Initializes a new instance of the ChannelManagerService class.

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

Examples

The following example demonstrates how to create a new instance of the ChannelManagerService object. 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)

Applies to

ChannelManagerService(IList<ServiceEndpoint>)

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))

Parameters

endpoints
IList<ServiceEndpoint>

A collection of service endpoints.

Examples

The following example demonstrates how to create a new instance of the ChannelManagerService object. 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()

Remarks

Instances of the ChannelManagerService class are usually created by the runtime using configuration files.

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.

Applies to

ChannelManagerService(NameValueCollection)

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

parameters
NameValueCollection

Configuration parameters for the service.

Examples

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)

Remarks

The following parameters are supported:

  • idleTimeout: The maximum TimeSpan that a cached channel can be idle.

  • leaseTimeout: The maximum TimeSpan that a cached channel can be checked out or in use by a SendActivity.

  • maxIdleChannelsPerEndpoint: The maximum number of idle channels matching a single endpoint that can be cached at any point.

Instances of the ChannelManagerService class are usually created by the runtime using configuration files.

Applies to

ChannelManagerService(ChannelPoolSettings)

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)

Parameters

settings
ChannelPoolSettings

Settings for quotas for the pool of channels managed by this service.

Examples

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)

Applies to

ChannelManagerService(ChannelPoolSettings, IList<ServiceEndpoint>)

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))

Parameters

settings
ChannelPoolSettings

Settings for quotas for the pool of channels managed by this service.

endpoints
IList<ServiceEndpoint>

A collection of service endpoints.

Examples

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)

Applies to