C# 如何使用ServicePartitionResolver发现服务提供的端点类型?

C# 如何使用ServicePartitionResolver发现服务提供的端点类型?,c#,azure,azure-service-fabric,C#,Azure,Azure Service Fabric,我正在尝试编写一个服务解析程序,为此我目前正在使用ServicePartitionResolver 到目前为止,这一切都相当有效。根据我的服务信息,我能够解决如下服务: var resolvedService = await ServicePartitionResolver.GetDefault().ResolveAsync(service.ServiceName, key, CancellationToken.None); 现在,为了使我的服务能够相互通信,我正在读取第一个端点地址,如: r

我正在尝试编写一个服务解析程序,为此我目前正在使用
ServicePartitionResolver

到目前为止,这一切都相当有效。根据我的服务信息,我能够解决如下服务:

var resolvedService = await ServicePartitionResolver.GetDefault().ResolveAsync(service.ServiceName, key, CancellationToken.None);
现在,为了使我的服务能够相互通信,我正在读取第一个端点地址,如:

resolvedService.Endpoints.First().Address
这将正确返回我在我的
ICommunicationListener
实现的
OpenAsync
方法中返回的所需端点

基本上,只要协议是http,这一切都做得很好

一旦我将协议切换到请求应该到达的服务的myServiceManifest.xml中的tcp之类的内容:

<Endpoints>
  <!-- This endpoint is used by the communication listener to obtain the port on which to 
       listen. Please note that if your service is partitioned, this port is shared with 
       replicas of different partitions that are placed in your code. -->
  <Endpoint Protocol="tcp" Name="ServiceEndpoint" Type="Input" Port="3245" />
</Endpoints>

servicesolver
仍然将我的端点解析为以
http
开头的地址

那么,现在我的问题是——我只是做错了什么吗?因为对我来说,似乎我真的不知道我到底在处理什么端点。即使这没有直接反映在地址中,我仍然可以从端点字符串中删除http部分,但是没有关于它是哪种端点的信息。因此,从技术上讲,我可以将
http://
替换为空白,但最好是基于我从ServiceFabric获得的信息,而不是“因为我知道端点”


有什么想法吗?

清单中的协议定义不用于定义端点。通信侦听器实现从
OpenAsync
返回端点。所以我建议在那里开始搜索

更多信息和信息