【发布时间】:2016-07-25 15:11:48
【问题描述】:
我有一个客户端应用程序,它与托管在服务器(我们将其称为 hostServer)上的 Web 服务进行通信。我的客户端应用程序可以使用 basicHttpBinding 构建和连接。但是,出于安全原因,我试图暗示 wsHttpBinding。
上周午餐前,我可以发誓它使用的是硬编码证书。吃完午饭回来,检查了我的代码,现在它不会运行了。我不断收到“https://hostServer:1234/Service.svc/MyServiceName 上没有可以接受消息的端点监听。这通常是由不正确的地址或 SOAP 操作引起的。”。我尝试重新检查我的设置,重新跟踪我的步骤,但似乎无法恢复到我所处的正常运行状态。
我正在使用地址为“https://hostServer:1234/Service.svc?singleWsdl”的 ServiceReference。我可以毫无问题地导航到“https://hostServer:1234/Service.svc”并查看 Wsdl。
我的客户代码是
WSHttpBinding wsBinding = new WSHttpBinding(SecurityMode.Transport);
wsBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate;
Client = new MyServiceName(wsBinding, new EndpointAddress(endpoint));
Client.ClientCredentials.ClientCertificate.SetCertificate(
StoreLocation.CurrentUser,
StoreName.My,
X509FindType.FindBySubjectName,
"localCertName");
Client.ChangePassword("test_user", "pt", "a1");
我的价值端点 = https://hostServer:1234/Service.svc/MyServiceName
我的 IIS 站点设置了 Http 和 Https 绑定(具有正确的 IP 和端口 ID)
我真的需要在起飞前让这段代码正常工作(我妻子随时都会带着我们的第二个孩子)。我已经调试了 2 天了,除了我花了一些时间让它保持原样。请帮忙。
【问题讨论】:
标签: web-services https wshttpbinding