共用方式為


IMultiVersionedServiceFactory.CreateAsync Method

Definition

Creates an instance of a ServiceHub service asynchronously.

public:
 System::Threading::Tasks::Task<System::Object ^> ^ CreateAsync(IServiceProvider ^ hostProvidedServices, Microsoft::ServiceHub::Framework::ServiceMoniker ^ serviceMoniker, Microsoft::ServiceHub::Framework::ServiceActivationOptions serviceActivationOptions, Microsoft::ServiceHub::Framework::IServiceBroker ^ serviceBroker, Microsoft::ServiceHub::Framework::Services::AuthorizationServiceClient ^ authorizationServiceClient, System::Threading::CancellationToken cancellationToken);
public System.Threading.Tasks.Task<object> CreateAsync (IServiceProvider hostProvidedServices, Microsoft.ServiceHub.Framework.ServiceMoniker serviceMoniker, Microsoft.ServiceHub.Framework.ServiceActivationOptions serviceActivationOptions, Microsoft.ServiceHub.Framework.IServiceBroker serviceBroker, Microsoft.ServiceHub.Framework.Services.AuthorizationServiceClient authorizationServiceClient, System.Threading.CancellationToken cancellationToken);
abstract member CreateAsync : IServiceProvider * Microsoft.ServiceHub.Framework.ServiceMoniker * Microsoft.ServiceHub.Framework.ServiceActivationOptions * Microsoft.ServiceHub.Framework.IServiceBroker * Microsoft.ServiceHub.Framework.Services.AuthorizationServiceClient * System.Threading.CancellationToken -> System.Threading.Tasks.Task<obj>
Public Function CreateAsync (hostProvidedServices As IServiceProvider, serviceMoniker As ServiceMoniker, serviceActivationOptions As ServiceActivationOptions, serviceBroker As IServiceBroker, authorizationServiceClient As AuthorizationServiceClient, cancellationToken As CancellationToken) As Task(Of Object)

Parameters

hostProvidedServices
IServiceProvider

Provides other services to the service.

serviceMoniker
ServiceMoniker

An identifier for a service.

serviceActivationOptions
ServiceActivationOptions

The activation options used to start the service.

serviceBroker
IServiceBroker

The IServiceBroker that can be used to request additional services.

authorizationServiceClient
AuthorizationServiceClient

The AuthorizationServiceClient retrieved from the IServiceBroker.

cancellationToken
CancellationToken

A cancellation token.

Returns

An instance of a ServiceHub service that implements.

Remarks

Uses GetServiceDescriptor(ServiceMoniker) to establishes an RPC connection over an IDuplexPipe. Adds ServiceHub service object to receive RPC calls and begins listening for incoming messages. The service will only be disposed if the ServiceRpcDescriptor does on disconnection.

Applies to