Authentication failed because the remote party has closed the transport stream exception when getting a response from webservice

后端 未结 2 531
难免孤独
难免孤独 2020-12-24 10:41

I am calling a third party service and when I ask for a response it throws out an exception that says

\"Authentication failed because the remote part

相关标签:
2条回答
  • 2020-12-24 11:21

    I had a limitation of using TLS 1.2 only and more than anything else the resource address (URL/address) was local. So above solution didn't work for me. After closely analysing web.config I tried using <bypasslist> for local URLs and miracle happened!

    <system.net>
        <defaultProxy>
          <proxy usesystemdefault="false" proxyaddress="<yourproxyaddress>" bypassonlocal="true" />
          <bypasslist>  
            <add address="[a-z]+\.abcd\.net\.au$" />  
          </bypasslist>
        </defaultProxy>
    </system.net>
    

    Please note I was already using <proxy> setting for accessing other external URLs so not having this setup was not allowed either. Hope this helps!

    0 讨论(0)
  • 2020-12-24 11:40

    I found the answer, It was because the third party webservice we were calling did not support TLS 1.0 they supported 1.1 and 1.2. So I had to change the security protocol.

    ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
    
    0 讨论(0)
提交回复
热议问题