WCF中的套接字连接中止

3

我在服务器端创建了动态端点,并由客户端使用。

服务器端代码:

 for (int i = 1; i <= 3; i++)
            {
                host.AddServiceEndpoint(typeof(PokerService.IPlayerService),
                                               new NetTcpBinding(),
                                               @"net.tcp://localhost:5054/player" + i);

            }

客户端:

NetTcpBinding binding = new NetTcpBinding(SecurityMode.Message);
binding.Name = "NetTcpBinding_IPlayerService";
binding.Security.Message.ClientCredentialType = MessageCredentialType.IssuedToken;


EndpointAddress myEndpointAdd = new EndpointAddress(new Uri("net.tcp://localhost:5054/player1"),
EndpointIdentity.CreateDnsIdentity("pident.cloudapp.net"));

var PlayerChannelFactory = new DuplexChannelFactory<ClientApplication.PlayerService.IPlayerService>(new PlayerHandler(handler, this), binding, myEndpointAdd);

但是在以下这一行代码中出现了错误:
Player loggedIn = PlayerServiceProxy.Login("testuser" + Guid.NewGuid().ToString());

错误信息为:

"套接字连接已中止。这可能是由于处理消息时出现错误或远程主机超过接收超时,或底层网络资源问题引起的。本地套接字超时为“00:00:59.9870000”。

有人有想法吗?

1个回答

0

看起来是超时了。请检查您的客户端和服务端超时配置。

此外,尝试使用svcTraceViewer.exe查看WCF跟踪日志。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接