.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 };