gpt4 book ai didi

c# - WCF 服务在多服务器环境中不起作用

转载 作者:行者123 更新时间:2023-12-05 07:48:13 24 4
gpt4 key购买 nike

我有下一个架构:

http://i.stack.imgur.com/ZLvR0.png

负载均衡器是在 AWS 上定制的。 WCF 由 Windows 服务托管。当只有一个 API 发送请求或两个 API 发送请求并且负载均衡器将两者都重定向到 WCF1(或 WCF2)服务器时,它会起作用。

当API1和API2同时发送请求时WCF1返回错误响应:

The server did not provide a meaningful reply; this might be caused by a contract mismatch, a premature session shutdown or an internal server error.

WCF2 返回错误响应:

The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '00:59:59.7299730'.

端点配置:

var netTcpBinding = new NetTcpBinding
{
ReceiveTimeout = TimeSpan.FromDays(1f),
MaxBufferSize = 52428800,
MaxReceivedMessageSize = 52428800,
SendTimeout = TimeSpan.FromHours(1),
Security = new NetTcpSecurity()
{
Mode = SecurityMode.None,
Message = new MessageSecurityOverTcp()
{
ClientCredentialType = MessageCredentialType.None
},
Transport = new TcpTransportSecurity()
{
ProtectionLevel = System.Net.Security.ProtectionLevel.None,
ClientCredentialType = TcpClientCredentialType.None,
}
}
};

端点地址:

net.tcp://LoadBalancerHost:port/ServiceName;

WCF 配置:

[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple, InstanceContextMode = InstanceContextMode.Single, 
IncludeExceptionDetailInFaults = true)]

我对负载平衡不熟悉,配置中似乎缺少某些内容。

有什么想法或建议吗?

谢谢。

最佳答案

AWS 负载均衡器只允许 HTTP 连接。

关于c# - WCF 服务在多服务器环境中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38868645/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com