通过互联网消费wcf服务
问题描述:
我有一个使用WsHttpBinding作为绑定的wcf服务。 此服务托管在具有公共IP的服务器上。 我需要通过互联网使用这种wcf服务,但它给了我下面的错误。通过互联网消费wcf服务
这里没有听取http://IP:9962/MyService的端点可以接受该消息。
任何帮助,非常感谢。
答
我找到了答案。 1-我需要在我使用的绑定上添加安全性。
binding.Security.Mode = SecurityMode.Message;
binding.Security.Message.ClientCredentialType = MessageCredentialType.UserName;
2-我需要在服务主机上添加自定义验证。
svh.Credentials.UserNameAuthentication.UserNamePasswordValidationMode = System.ServiceModel.Security.UserNamePasswordValidationMode.Custom;
People365UserNameValidator cs = new People365UserNameValidator();
svh.Credentials.UserNameAuthentication.CustomUserNamePasswordValidator = cs;
svh.Credentials.ServiceCertificate.SetCertificate(StoreLocation.LocalMachine,
StoreName.TrustedPeople, X509FindType.FindByIssuerName, "Certificate Name");
3-我需要在计算机
答
这是一个非标准的HTTP端口,所以我的第一个问题是 - 防火墙/路由问题?
+0
我打开服务器上的防火墙的MMC添加证书,仍然有同样的错误 – 2011-05-20 14:12:44
+2
你可以telnet到试图建立连接的计算机上的端口9962上的IP? – DaveRead 2011-05-20 14:24:39
一些代码,请... – Reniuz 2011-05-20 14:12:21