这是我的服务器端app.config
:
<services>
<service name="PokerService.PlayerService" behaviorConfiguration="ServiceBehaviorPlayer">
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:5054" />
</baseAddresses>
</host>
<!-- Service Endpoints -->
<endpoint address="player" binding="netTcpBinding" bindingConfiguration="PlayerBinding" contract="PokerService.IPlayerService" />
<endpoint address="player/mex" binding="mexTcpBinding" name="ServiceBehaviorPlayer" contract="IMetadataExchange" />
</service>
</services>
我正在客户端代码中生成动态端点:
ServiceHost host = new ServiceHost(typeof(PokerService.PlayerService));
NetTcpBinding binding = new NetTcpBinding(SecurityMode.Message);
binding.Name = "NetTcpBinding_IPlayerService";
binding.Security.Message.ClientCredentialType = MessageCredentialType.IssuedToken;
ServiceEndpoint ep = host.AddServiceEndpoint(
typeof(PokerService.IPlayerService),
binding,
"net.tcp://localhost:5054");
EndpointAddress myEndpointAdd = new EndpointAddress(new Uri("net.tcp://localhost:5054/player1"),
EndpointIdentity.CreateDnsIdentity("pident.cloudapp.net"));
ep.Address = myEndpointAdd;
对于服务测试代码:
var PlayerChannelFactory = new DuplexChannelFactory<ClientApplication.PlayerService.IPlayerService>(new PlayerHandler(handler, this), binding, ep.Address);
PlayerChannelFactory.Credentials.SupportInteractive = false;
PlayerChannelFactory.Credentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None;
PlayerServiceProxy = PlayerChannelFactory.CreateChannelWithIssuedToken(User.Instance.userToken);
现在我收到此错误
任何想法?