簡體   English   中英

通過互聯網使用wcf服務

[英]Consuming a wcf service over the internet

我有一個使用WsHttpBinding作為綁定的wcf服務。 此服務托管在具有公共IP的服務器上。 我需要通過互聯網使用這個wcf服務,但它給了我以下錯誤。

這里沒有端點監聽http:// IP:9962 / MyService可以接受該消息。

非常感謝任何幫助。

這是一個非標准的HTTP端口,所以我的第一個問題是 - 防火牆/路由問題?

我找到了答案。 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中添加證書

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM