积极答复者
异常:传出消息标识检查失败。所预期的远程终结点的 DNS 标识为“localhost”...

问题
答案
全部回复
-
这个服务端的把Identity里的DNS给移掉。
换个别的应该也可以。
但是 就怕 你客户端的配置文件里已经指定了服务的Identity是基于DNS的,这个就不好办了。服务端必须和客户端的一致。
如果客户端没指定的话,我猜测,服务端也可以不使用。
Frank Xu Lei--谦卑若愚,好学若饥
专注于.NET平台下分布式应用系统开发和企业应用系统集成
Focus on Distributed Applications Development and EAI based on .NET
【老徐的网站】:http://www.frankxulei.com/
【老徐的博客】:http://www.cnblogs.com/frank_xl/
-
我明白客户端与服务端dns要保持一致,现在我要调整服务端的dns设置,一直也没有成功,不知道怎么弄,是不是在设置证书后,服务端的dns不能变动了,还是可以通过什么方法来调整? 代码类似如下: 服务端: myServiceHost = new ServiceHost(typeof(GetTest)); myServiceHost.Credentials.ServiceCertificate.SetCertificate("CN=test1", System.Security.Cryptography.X509Certificates.StoreLocation.LocalMachine, System.Security.Cryptography.X509Certificates.StoreName.My); NetTcpBinding myBinding = new NetTcpBinding(); myBinding.Security.Mode = SecurityMode.Message; myBinding.Security.Message.ClientCredentialType =MessageCredentialType.None; Uri baseAddress = new Uri(net.tcp://localhost:8056/WCFService/); ServiceEndpoint ep = myServiceHost.AddServiceEndpoint(typeof(IGetTest), myBinding, baseAddress); //这段代码似乎也改变不了 //EndpointAddressBuilder addressBuilder = new EndpointAddressBuilder(ep.Address); //addressBuilder.Identity = EndpointIdentity.CreateDnsIdentity(test.com); //ep.Address = addressBuilder.ToEndpointAddress(); myServiceHost.Open(); Console.WriteLine(Service started!); Console.ReadLine(); myServiceHost.Close(); 客户端: NetTcpBinding myBinding = new NetTcpBinding(); myBinding.Security.Mode = SecurityMode.Message; myBinding.Security.Message.ClientCredentialType=MessageCredentialType.None; EndpointAddress ea = new EndpointAddress(net.tcp://localhost:8056/WCFService/GetTest); GetTestClient gc = new GetTestClient(myBinding, ea); gc.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = System.ServiceModel.Security.X509CertificateValidationMode.None; string result = gc.GetValue(); Console.WriteLine(result); Console.ReadLine();
-
我不是完全了解。在HTTPS protocol中,服务器的证书Subject要求要和域名保持一致,负责就被认为站点不安全。比如,你浏览 https://www.verisign.com ,查看一下他的证书。
你使用的WCF Message Security也会有类似的要求,但是并非强制,好像可以通过修改客户端endpoint dns identity来指定期望的dns地址。
Mog Liang