我有一个WCF服务正在用作我们正在与之集成的第三方asmx服务的包装。它正在与之通信的服务是使用Visual Studio中的“添加服务”引用对话框添加的。 WCF服务中的代码在单元测试中执行时工作,并且在调试Host应用程序时也可以工作。在IIS中运行时WCF服务无法连接到Web服务
调试主机在ASP.NET开发服务器中运行时,它可以正常工作。当我将应用程序部署到本地IIS实例(同开发机,IIS 5.1),该服务将启动和运行,但连接OT第三方ASMX端点时,它抛出这个错误:
System.ServiceModel.Security.SecurityNegotiationException:
Could not establish trust relationship for the SSL/TLS secure channel with
authority 'xxxxx.thirdparty.com'. ---> System.Net.WebException: The underlying
connection was closed: Could not establish trust relationship for the SSL/TLS
secure channel. ---> System.Security.Authentication.AuthenticationException:
The remote certificate is invalid according to the validation procedure.
这些设置在服务端点的配置文件中:
<basicHttpBinding>
<binding name="ServiceSoap" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="false" proxyAddress="http://[internalWebProxyHere]">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
<security mode="Transport">
<transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
<message clientCredentialType="UserName" algorithmSuite="Default"/>
</security>
</binding>
</basicHttpBinding>
该服务在Visual Studio中工作,但不在部署到IIS之后。我能做些什么来调试AuthenticationExceptions?
编辑:客户端的端点是这样的:
<endpoint address="https://'xxxxx.thirdparty.com/thirdpartyendpoint.asmx"
binding="basicHttpBinding" bindingConfiguration="ServiceSoap"
contract="eContracting.ServiceSoap" name="ServiceSoap"
behaviorConfiguration="Behavior"/>
我尝试添加的终结点行为来禁用证书验证,但这并没有帮助:
<behavior name="Behavior">
<clientCredentials>
<serviceCertificate>
<authentication certificateValidationMode="None"/>
</serviceCertificate>
</clientCredentials>
</behavior>
如果这也有助于第三方证书由Rapid SSL CA颁发,证书有效。查看我的本地证书存储区,此证书位于“中级证书颁发机构”选项卡中,但不在“受信任的根证书颁发机构”或“受信任的发布者”中。
编辑:该问题已通过将证书添加到“受信任的根证书颁发机构”得到解决,尽管存在一个问题。
- 从ControlPanel导入证书 - > InternetProperties - > Content - >证书。如果以这种方式安装,则表示它已成功,但不会在winhttpcertcfg中显示。
- 通过执行导入证书开始 - >运行 - >键入'certmgr.msc'并通过这里安装。它会说成功导入,但证书不可用于winhttpcertcfg。
- 通过开始 - >运行 - > MMC导入证书并使用证书snapin工作正常。点击here查看Windows XP的说明。
具体来说,这是什么工作:
- 开始 - >运行 - > MMC
- 文件 - >添加/管理单元
- 单击添加删除...
- 选择证书并单击添加
- 选择计算机帐户然后单击下一步
- 选择本地计算机,然后单击Finish(完成)
- 单击关闭
导入证书从控制台根到以下地点:
- 受信任的根证书颁发机构
- 中级证书颁发机构
- 第三方根证书颁发机构
是本地计算机上的“本地”IIS实例(与您正在开发的计算机相同)还是您的网络等的“本地”。 – 2012-07-17 17:31:46
本地机器。 – 2012-07-17 17:34:15
什么是客户端设置? – 2012-07-17 18:24:29