HubClient.GetRemoteServiceBrokerForServiceAsync 方法

定义

获取与 IRemoteServiceBroker 正在请求的服务相关的。

protected virtual System.Threading.Tasks.Task<Microsoft.ServiceHub.Framework.IRemoteServiceBroker> GetRemoteServiceBrokerForServiceAsync (Microsoft.ServiceHub.Framework.ServiceMoniker consumingService, System.Collections.Generic.IReadOnlyDictionary<string,string> userCredentials, System.Threading.CancellationToken cancellationToken = default);
abstract member GetRemoteServiceBrokerForServiceAsync : Microsoft.ServiceHub.Framework.ServiceMoniker * System.Collections.Generic.IReadOnlyDictionary<string, string> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.ServiceHub.Framework.IRemoteServiceBroker>
override this.GetRemoteServiceBrokerForServiceAsync : Microsoft.ServiceHub.Framework.ServiceMoniker * System.Collections.Generic.IReadOnlyDictionary<string, string> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.ServiceHub.Framework.IRemoteServiceBroker>
Protected Overridable Function GetRemoteServiceBrokerForServiceAsync (consumingService As ServiceMoniker, userCredentials As IReadOnlyDictionary(Of String, String), Optional cancellationToken As CancellationToken = Nothing) As Task(Of IRemoteServiceBroker)

参数

consumingService
ServiceMoniker

ServiceMoniker请求的服务的 IRemoteServiceBroker

userCredentials
IReadOnlyDictionary<String,String>

要用于筛选返回的 ServiceBroker 的用户的凭据。

cancellationToken
CancellationToken

取消标记。

返回

Task<IRemoteServiceBroker>

IRemoteServiceBroker 正在请求的服务相关的。

注解

返回的对象会在服务通过其连接时 (实现 IDisposable) 来释放。 默认实现每次都会返回一个新的对象,但是新对象只是同一 IRemoteServiceBroker 代理的包装。 返回的对象也不应是 JsonRpc 代理,因为它将通过 JsonRpc 附加到 Stream

适用于