BasicHttpBinding 和 Https 結合,手工編程實現

雖然用config文件可以輕鬆實現BasicHttpBinding 和 Https,但是如果是一個庫的話,最好手工編程實現,這樣不用把config文件拷來拷去。


BasicHttpBinding binding = new BasicHttpBinding();
binding.Security.Mode = BasicHttpSecurityMode.Transport;      
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;
binding.MaxReceivedMessageSize = 10 * 1024 * 1024;
EndpointAddress ep = new EndpointAddress(url);
PortalServiceSoap proxy = ChannelFactory<PortalServiceSoap>.CreateChannel(binding, ep);
quoteReturn = proxy.WebMethod(requestObject);


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章