简体   繁体   English

通过互联网使用wcf服务

[英]Consuming a wcf service over the internet

I have a wcf service that uses the WsHttpBinding as a binding. 我有一个使用WsHttpBinding作为绑定的wcf服务。 This service is hosted on a server that has a public IP. 此服务托管在具有公共IP的服务器上。 I need to consume this wcf service over the internet, but it is giving me the below error. 我需要通过互联网使用这个wcf服务,但它给了我以下错误。

here was no endpoint listening at http://IP:9962/MyService that could accept the message. 这里没有端点监听http:// IP:9962 / MyService可以接受该消息。

Any Help is very appreciated. 非常感谢任何帮助。

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

I found the answer. 我找到了答案。 1- I need to add security on the binding that i am using. 1-我需要在我正在使用的绑定上添加安全性。

binding.Security.Mode = SecurityMode.Message;
binding.Security.Message.ClientCredentialType = MessageCredentialType.UserName;

2- I need to add custom authentication on the service host. 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- i need to add a certificate in the mmc of the computer 3-我需要在计算机的mmc中添加证书

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM