2011-05-20 134 views
3

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

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

任何幫助,非常感謝。

+0

一些代碼,請... – Reniuz 2011-05-20 14:12:21

回答

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-我需要在計算機

0

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

+0

我打開服務器上的防火牆的MMC添加證書,仍然有同樣的錯誤 – 2011-05-20 14:12:44

+2

你可以telnet到試圖建立連接的計算機上的端口9962上的IP? – DaveRead 2011-05-20 14:24:39