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'。”

有人知道吗?

4

1 回答 1

0

好像超时了。检查您的客户端和服务超时配置。

另外,尝试使用 svcTraceViewer.exe 查看 wcf 跟踪

于 2013-04-19T13:06:31.090 回答