TCP 错误代码 10061:无法连接到 net.tcp://。连接尝试持续了 00:00:01.0156241 的时间跨度

TCP error code 10061 : Could not connect to net.tcp://. The connection attempt lasted for a time span of 00:00:01.0156241

我在服务器中安装了windows服务(IP:10.60.8.27,端口7002)。当尝试从另一台服务器 (10.60.8.28) 中托管的 WCF 服务进行连接时,会发生以下错误。偶尔会出现此错误。当我重新启动 windows 服务时,它运行良好。我该如何解决这个问题?我的服务器是 (Windows Server 2012 R2).

错误是:

Could not connect to net.tcp://10.60.8.27:7002/MyService. The connection attempt lasted for a time span of 00:00:01.0156241. TCP error code 10061: No connection could be made because the target machine actively refused it 10.60.8.27:7002. 

我对你的问题有点疑惑,没有完全理解你的场景。
在我看来,当服务器使用证书保护通信时,客户端通常会在添加服务引用时生成一个 DNS 身份来验证服务器身份。这可能会导致上述错误。

<client>
    <endpoint address="net.tcp://vabqia969vm:21011/" binding="netTcpBinding"
        bindingConfiguration="NetTcpBinding_IService1" contract="ServiceReference1.IService1"
        name="NetTcpBinding_IService1">
        <identity>
            <dns value="vabqia969VM" />
        </identity>
    </endpoint>
</client>

当服务器使用证书保护通信安全时,DNS 标记允许客户端验证服务器身份。
https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/service-identity-and-authentication
此外,我们也不排除机器的性能。如果瞬间客户端对服务器的请求量激增,基本上就是存在大量的请求超时。
无论如何,请尝试并给我反馈。