共用方式為


GlobalBrokeredServiceContainer.GetTraceSourceForConnectionAsync Method

Definition

Gets a TraceSource to apply to some brokered service.

protected virtual System.Threading.Tasks.ValueTask<System.Diagnostics.TraceSource?> GetTraceSourceForConnectionAsync (Microsoft.ServiceHub.Framework.IServiceBroker serviceBroker, Microsoft.ServiceHub.Framework.ServiceMoniker serviceMoniker, Microsoft.ServiceHub.Framework.ServiceActivationOptions options, bool clientRole, System.Threading.CancellationToken cancellationToken);
abstract member GetTraceSourceForConnectionAsync : Microsoft.ServiceHub.Framework.IServiceBroker * Microsoft.ServiceHub.Framework.ServiceMoniker * Microsoft.ServiceHub.Framework.ServiceActivationOptions * bool * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<System.Diagnostics.TraceSource>
override this.GetTraceSourceForConnectionAsync : Microsoft.ServiceHub.Framework.IServiceBroker * Microsoft.ServiceHub.Framework.ServiceMoniker * Microsoft.ServiceHub.Framework.ServiceActivationOptions * bool * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<System.Diagnostics.TraceSource>
Protected Overridable Function GetTraceSourceForConnectionAsync (serviceBroker As IServiceBroker, serviceMoniker As ServiceMoniker, options As ServiceActivationOptions, clientRole As Boolean, cancellationToken As CancellationToken) As ValueTask(Of TraceSource)

Parameters

serviceBroker
IServiceBroker

A service broker that may be used to create the TraceSource.

serviceMoniker
ServiceMoniker

The moniker of the service being requested.

options
ServiceActivationOptions

The activation options accompanying the request.

clientRole
Boolean

true if the TraceSource will be used by the client of the service; false if used by the service itself.

cancellationToken
CancellationToken

A cancellation token.

Returns

A TraceSource instance that has the appropriate verbosity and listeners preconfigured, or null if the host provides no instance.

Remarks

This method should be called by IServiceBroker implementations when requesting or activating services. The result of this method should be passed to WithTraceSource(TraceSource) before constructing the RPC connection.

Applies to