通过互联网使用wcf服务

时间:2011-05-20 14:09:30

标签: c# wcf .net-4.0

我有一个使用WsHttpBinding作为绑定的wcf服务。 此服务托管在具有公共IP的服务器上。 我需要通过互联网使用这个wcf服务,但它给了我以下错误。

这里没有可以接受该消息的http://IP:9962/MyService端点。

非常感谢任何帮助。

2 个答案:

答案 0 :(得分:0)

这是一个非标准的HTTP端口,所以我的第一个问题是 - 防火墙/路由问题?

答案 1 :(得分:0)

我找到了答案。 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-我需要在计算机的mmc中添加证书

相关问题