【问题标题】:TCP error code 10061 : Could not connect to net.tcp://. The connection attempt lasted for a time span of 00:00:01.0156241TCP 错误代码 10061:无法连接到 net.tcp://。连接尝试持续了 00:00:01.0156241 的时间跨度
【发布时间】:2020-03-28 23:13:47
【问题描述】:

我在服务器中安装了 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. 

【问题讨论】:

    标签: c# wcf windows-services


    【解决方案1】:

    我对您的问题有点困惑,没有完全理解您的情况。
    在我看来,当服务器使用证书保护通信时,客户端通常会在添加服务引用时生成一个 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
    此外,我们也不能排除机器的性能。如果瞬间客户端对服务端的请求量猛增,基本上就存在大量的请求超时。
    无论如何,请尝试并给我反馈。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-06-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多