【发布时间】:2017-07-01 08:54:19
【问题描述】:
我在 Azure 的 Service Fabric 群集中托管了一项服务(不是本地),我正在尝试使用本地计算机上的控制台应用程序调用其中的方法。使用 WCF 进行通信,我在我的应用程序中的特定端口上设置了一个 HTTPS 端点,并在 Azure 门户中为该端口配置了负载平衡规则。集群有 6 个节点,应用程序是唯一部署在集群上的节点。
已遵循 GitHub (link) 上的 ServiceFabric.WcfCalc,它在使用 HTTP 端点的本地集群上工作,但一旦部署,就无法使用 HTTPS 端点调用服务上的方法。我需要做什么才能让它工作?已尝试按照示例 here 进行操作,但不知道如何为 HTTPS 配置此功能,并在多个节点上提供服务以供控制台应用程序访问。
提前致谢。
编辑这是我用来调用服务方法的客户端代码。我在这里将 fabric:/ URI 传递给构造函数。
public class Client : ServicePartitionClient<WcfCommunicationClient<IServiceInterface>>, IServiceInterface
{
private static ICommunicationClientFactory<WcfCommunicationClient<IServiceInterface>> communicationClientFactory;
static Client()
{
communicationClientFactory = new WcfCommunicationClientFactory<IServiceInterface>(
clientBinding: new BasicHttpBinding(BasicHttpSecurityMode.Transport));
}
public Client(Uri serviceUri)
: this(serviceUri, ServicePartitionKey.Singleton)
{ }
public Client(
Uri serviceUri,
ServicePartitionKey partitionKey)
: base(
communicationClientFactory,
serviceUri,
partitionKey)
{ }
public Task<bool> ServiceMethod(DataClass data)
{
try
{
//It hangs here
return this.InvokeWithRetry((c) => c.Channel.ServiceMethod(data));
}
catch (Exception)
{
throw;
}
}
}
在本地计算机上调试控制台应用程序时,应用程序挂起在调用 Service Fabric 中我的服务中的方法的 InvokeWithRetry 调用上。应用程序不会抛出任何异常,也不会返回到 Visual Studio 中的调试器。
【问题讨论】:
-
部署到集群后尝试调用服务上的方法时看到什么错误或问题?超时还是其他?
-
我的代码中没有抛出异常,尽管我确实在 Service Fabric 群集资源管理器中看到了以下警告:-“HTTP 无法注册 URL http://+:443/26c710ea-38b9-4416 -9d70-c1710e698521/8d259277-ed49-4e11-b7ec-fac80075297e-131314658022522000/。另一个应用程序已经用 HTTP.SYS 注册了这个 URL。”当我从本地计算机上的控制台应用程序调用服务方法时,就会发生这种情况。上面已编辑问题以反映这一点。
-
如果您正确配置了端点,我希望在 URL 中看到 HTTPS 而不是 HTTP。
标签: wcf azure azure-service-fabric