使用 add Web Reference添加 web service。
导入 System.Security
代码:
[code]
using System.Security.Cryptography.X509Certificates;
using System.Net;
using System.Security.Authentication;
using System.Net.Security;
using WebServiceWithSSL.localhost;
X509Store store = new X509Store(StoreName.My, StoreLocation.CurrentUser);
store.Open(OpenFlags.ReadOnly | OpenFlags.OpenExistingOnly);
X509Certificate2Collection certs = X509Certificate2UI.SelectFromCollection(store.Certificates, "Certificates", "Please select certificate to use", X509SelectionFlag.SingleSelection);
localhost.Version vs = new localhost.Version();
vs.ClientCertificates.Add(certs[0]);
string wsRet = vs.getVersion().@return;[/code]
导入 System.Security
代码:
[code]
using System.Security.Cryptography.X509Certificates;
using System.Net;
using System.Security.Authentication;
using System.Net.Security;
using WebServiceWithSSL.localhost;
X509Store store = new X509Store(StoreName.My, StoreLocation.CurrentUser);
store.Open(OpenFlags.ReadOnly | OpenFlags.OpenExistingOnly);
X509Certificate2Collection certs = X509Certificate2UI.SelectFromCollection(store.Certificates, "Certificates", "Please select certificate to use", X509SelectionFlag.SingleSelection);
localhost.Version vs = new localhost.Version();
vs.ClientCertificates.Add(certs[0]);
string wsRet = vs.getVersion().@return;[/code]