wcf - 在 Azure Service Fabric 中托管 WCF 服务
问题描述
我有一组想要迁移到 Azure Service Fabric 的 WCF 服务。我正在为每个 WCF 服务创建一个服务结构无状态服务,并从我的结构服务中引用 WCF 服务库和合同。我的目标是对现有 WCF 服务库和合同进行零代码更改。结构服务就像包装器一样。
对于简单的服务,我是成功的,我将 WCF 服务配置放入结构服务(.NET 框架)的 app.config 文件中system.configuration.configurationmanager
,现有 wcf 代码中的调用似乎工作正常。
但是,我尝试迁移的许多更复杂的服务都包含使用ChannelFactory
. 我想知道这会起作用吗?Azure Service Fabric 是否允许其服务通过 进行外部通信调用ChannelFactory
?
如何读取服务结构中的 WCF 跟踪日志?没有本地驱动器来存储日志文件?
当客户端在结构中调用 wcf 服务时,我也会收到通用连接关闭错误。
[编辑] 负载均衡器已配置,但客户端仍然无法通过:
Could not connect to net.tcp://10.0.0.6:9012/. The connection attempt lasted for a time span of 00:00:21.0433425. TCP error code 10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 10.0.0.6:9012.
Server stack trace:
at System.ServiceModel.Channels.SocketConnectionInitiator.Connect(Uri uri, TimeSpan timeout)
at System.ServiceModel.Channels.BufferedConnectionInitiator.Connect(Uri uri, TimeSpan timeout)
at System.ServiceModel.Channels.ConnectionPoolHelper.EstablishConnection(TimeSpan timeout)
at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.CallOpenOnce.System.ServiceModel.Channels.ServiceChannel.ICallOnce.Call(ServiceChannel channel, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSpan timeout, CallOnceManager cascade)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Inner Exception:
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 10.0.0.6:9012
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)
at System.ServiceModel.Channels.SocketConnectionInitiator.Connect(Uri uri, TimeSpan timeout)
解决方案
Azure Service Fabric 是否允许其服务通过 ChannelFactory 进行外部通信调用?
- Service Fabric 不会阻止您通过网络进行调用。请确保您在服务清单中声明了一个端点,以便为调用保留该端口。
如何读取服务结构中的 WCF 跟踪日志?没有本地驱动器来存储日志文件?
当客户端在结构中调用 wcf 服务时,我也会收到通用连接关闭错误。
您是否将 Azure负载均衡器配置为将流量转发到集群?
您是否考虑将WCF服务作为Windows 容器运行?这样,您可能根本不需要创建 SF 服务。
请注意,WCF 似乎没有光明的未来。
推荐阅读
- c# - 适用于多种数据类型的通用 SQL UPDATE 子句
- android - SQLite - 将我要插入到数据库中的多行字符串,导致我的 java 类有很多代码行
- python - 使用linux命令输出错误的字符串输入
- java - 即使我关闭,Java 线程调度程序仍然存在
- firebase - Firebase Messaging 7.0.0 到 9.0.1 的转换
- swift - 关于使用带有 State 属性的数组的问题
- spring-boot - spring webflux中带有多部分数据的POST请求
- python - WebDriver Selenium Execute_Script 下载 .Tmp 文件
- xml - 如何在使用 @XmlRootElement 进行 XML 编组时设置编组器属性
- spring-boot - Webflux Webclient 未设置 Content-Range 标头