通过互联网使用WCF服务

3
我有一个使用WsHttpBinding绑定的WCF服务。 该服务托管在具有公共IP的服务器上。 我需要通过互联网使用此WCF服务,但出现了以下错误。
没有终结点侦听器在http://IP:9962/MyService上可以接受消息。
非常感谢您的任何帮助。
2个回答

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中添加证书


0

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


我关闭了服务器上的防火墙,但仍然出现相同的错误。 - Ghyath Serhal
2
你能否从试图建立连接的机器上telnet到9962端口的IP地址? - DaveRead

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接