ChannelManagerService 建構函式
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
初始化 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)