2009-05-18 36 views
0

我在通過身份驗證代理使用基本通過WSHttpBinding進行身份驗證時遇到問題。是否可以通過使用WsHttpBinding的基本身份驗證代理?

BasicHttpBinding的相似的編碼。我猜測,我的問題的東西的事實,我不能設置的WSHttpBinding的安全模式TransportCredentialOnly ..

我不能使用,因爲MTOM上的依賴的basicHttpBinding的事。所有的一件事

 binding.ProxyAddress = new Uri("http://192.168.20.231:8080"); 
     binding.BypassProxyOnLocal = true; 
     binding.UseDefaultWebProxy = false; 

     WSHttpSecurity security = binding.Security; 

     //security.Mode = SecurityMode.TransportCredentialOnly; //This option only exist for BasichHttpBinding 
     security.Mode = SecurityMode.Transport; // Not sure what to set here 

     //security.Mode = SecurityMode.TransportWithMessageCredential; 
     security.Transport.ProxyCredentialType = HttpProxyCredentialType.Basic; 
     security.Transport.ClientCredentialType = HttpClientCredentialType.Basic; 


     var client = new SyncWcfMTOMServiceClient(binding, new EndpointAddress("http://server/service.svc")); 

     client.ClientCredentials.UserName.UserName = "user"; 
     client.ClientCredentials.UserName.Password = "pass"; 
     bool running = client.IsServiceRunning(); 

回答

0

經過一番研究,我找到了答案。 (我不是與解決方案完全滿意,並希望有另一種方式來解決這個問題)

的wsHttpBinding不允許以明文形式發送用戶名和密碼,甚至沒有到本地身份驗證代理! basicHttpBinding的沒有這個問題

一些測試,我發現我可以得到它通過安裝在主機服務器上安裝服務器證書的工作(不與代理服務器相混淆)之後。

通過在服務器上安裝SSL證書,以上代碼無需修改即可正常工作。服務器上的SSL爲我創建了許多問題。

解決此問題的其他方法?

0

IST我想在這裏指出Security.Mode =交通運輸在使用的情況下,如果你的目標服務託管在HTTPS(SSL),這是不是與你指定的URL

的情況下
security.Mode = SecurityMode.Transport; // Not sure what to set here 
+0

它不是託管在https上它是一個非常標準的代理服務器 – 2009-05-18 12:38:43

相關問題