.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