1.打开vs,在需要引用的项目中打开<管理链接的服务>点击打开
2.点击加号
3.选中WCF WEB Service点击下一步
4.
5.
6. 点击完成
7.点击完成后,系统中会生成连接的文件
8.再调用的地方引用
BasicHttpsBinding binding = new BasicHttpsBinding();
EndpointAddress address = new EndpointAddress("访问的地址");
ShareDataInterfaceServiceClient client = new ShareDataInterfaceServiceClient(binding, address);
client.ClientCredentials.ServiceCertificate.SslCertificateAuthentication = new System.ServiceModel.Security.X509ServiceCertificateAuthentication()
{
CertificateValidationMode = System.ServiceModel.Security.X509CertificateValidationMode.None,
RevocationMode = System.Security.Cryptography.X509Certificates.X509RevocationMode.NoCheck
};
Task<getSgsPublicListByCountyCodeResponse> responseTask = client.getSgsPublicListByCountyCodeAsync("52702C80C36A48F99E6972011110A982", "1", "10", "410621", "1");
getSgsPublicListByCountyCodeResponse response = responseTask.Result;
// 获取HelloWorld方法的返回值
string result1 = response.Body.@return;