.net core 引用 webservice 服務


.net core 無法引用失敗的情況


 

1、通過.net framework 工程進行添加

2、copy 代理類 Reference.cs 到.net core 工程下

3、nuget 添加 System.ServiceModel.Http

4、調用代碼

BasicHttpBinding binding = new BasicHttpBinding();

EndpointAddress address = new EndpointAddress("http://192.0.4.223:8088/EnterpriseSpace/BPMService.asmx");

BPMServiceSoapClient client = new BPMServiceSoapClient(binding, address);

var response = client.GetHashCode();

 

連https的webservice情況


BasicHttpBinding binding = new BasicHttpBinding();
binding.Security.Mode
= BasicHttpSecurityMode.Transport;
EndpointAddress address
= new EndpointAddress("https://2.20.200.2:8180/test/services/ESBWebService");
ESBServiceClient callClient
= new ESBServiceClient(binding, address); //跳過檢查驗證 callClient.ClientCredentials.ServiceCertificate.SslCertificateAuthentication = new X509ServiceCertificateAuthentication() { CertificateValidationMode = X509CertificateValidationMode.None, RevocationMode = X509RevocationMode.NoCheck };

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM