简体   繁体   中英

Consuming a wcf service over the internet

I have a wcf service that uses the WsHttpBinding as a binding. This service is hosted on a server that has a public IP. I need to consume this wcf service over the internet, but it is giving me the below error.

here was no endpoint listening at http://IP:9962/MyService that could accept the message.

Any Help is very appreciated.

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

I found the answer. 1- I need to add security on the binding that i am using.

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

2- I need to add custom authentication on the service host.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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