我对Web服务的开发很新,我有一个问题。 有没有办法配置web.config文件,以便我的Web服务可以接受任何端点证书?
关键是我的webservice指向另一个通过https监听端口4799的Web服务,而我现在得到的错误是:
System.ServiceModel.Security.SecurityNegotiationException:可以 不与SSL / TLS安全通道建立信任关系 权威'localhost:4799'。 ---> System.Net.WebException:The 底层连接已关闭:无法建立信任 SSL / TLS安全通道的关系。 ---> System.Security.Authentication.AuthenticationException:远程 证书根据验证程序无效。
这是我的web.config:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<configSections>
</configSections>
<system.web>
<identity impersonate="true" userName="COSMO\adminqlik2" password="Ql1kAdmin!" />
<compilation targetFramework="4.0" />
</system.web>
<system.serviceModel>
<extensions>
<behaviorExtensions>
<add name="serviceKeyBehavior" type="EDXWrapper.ServiceKeyBehaviorExtensionElement, EDXWrapper, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
</behaviorExtensions>
</extensions>
<behaviors>
<endpointBehaviors>
<behavior name="ServiceKeyEndpointBehavior">
<serviceKeyBehavior />
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IQMS">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Ntlm" />
</security>
</binding>
<binding name="BasicHttpBinding_IQTService">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Ntlm" />
</security>
</binding>
</basicHttpBinding>
<wsHttpBinding>
<binding name="WsSecured">
<security mode="Transport">
<transport clientCredentialType="None" />
<message clientCredentialType="None"
negotiateServiceCredential="false"
establishSecurityContext="false" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="https://localhost:4799/QMS/Service" binding="wsHttpBinding" bindingConfiguration="WsSecured" contract="QmsAPI.IQMS" name="WsSecured_IQMS" behaviorConfiguration="ServiceKeyEndpointBehavior" />
<endpoint address="https://localhost:4799/ANY/Service" binding="wsHttpBinding" bindingConfiguration="WsSecured" contract="QmsAPI.IQTService" name="WsSecured _IQTService" behaviorConfiguration="ServiceKeyEndpointBehavior" />
</client>
</system.serviceModel>
<system.webServer>
<httpErrors existingResponse="PassThrough"></httpErrors>
<directoryBrowse enabled="false" />
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Headers" value="Origin, X-Requested-With, Content-Type, Accept" />
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>
我该怎么办?
提前致谢。