2014-06-26 29 views
1

有沒有辦法忽略SSL證書錯誤?忽略Web服務中的證書錯誤?

我開發了一個web服務,它直到現在已經使用http本地運行,但是它已被外部移動並需要通過https進行通信。用於測試目的的證書是自簽名的,因此不信任,我得到的錯誤The provided URI scheme 'https' is invalid; expected 'http'.

的Web.config

<system.serviceModel> 
    <bindings> 
     <basicHttpBinding> 
      <binding name="RemoteSoap" /> 
     </basicHttpBinding> 
    </bindings> 
    <client> 
     <endpoint address="https://mydomainwebservice:8444/Test.asmx" binding="basicHttpBinding" 
    bindingConfiguration="RemoteSoap" contract="RemoteService.RemoteSoap" 
    name="RemoteSoap" /> 
    </client> 
</system.serviceModel> 

如果我添加了以下安全元素然後我得到以下錯誤The remote certificate is invalid according to the validation procedure.這似乎是由The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.

<security mode="Transport"> 
    <transport clientCredentialType="None" /> 
</security> 

引起可有人請告知以忽略這些錯誤?

回答

2

嘗試在.config編輯配置值

<configuration> 
<system.net> 
    <settings> 
    <servicePointManager 
     checkCertificateName="false" 
     checkCertificateRevocationList="false"  
    /> 
    </settings> 
</system.net> 
</configuration>