2

The C# service is using RestSharp to fetch some data from the given url. The remote site uses ssl. The task is recurring on every 5 minutes and doing fine.

However, on every few hours the service is getting:

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.

I saw that some people are suggesting avoiding the certificate validation, but I don't think it's a good idea.

Does anyone have the idea what could be the cause of this strange behaviour?

user1666620
  • 4,800
  • 18
  • 27
manda
  • 228
  • 1
  • 10
  • did you add the certificate as a trusted cert? – user1666620 Oct 12 '15 at 15:19
  • acess the web service url in browser and check what information it gives about certificate. Check what is the validation error message. If you are using this in dev environment you can ignore this error. – Shetty Oct 12 '15 at 15:22
  • Well browsers say that the certificate is valid. It's not the dev environment, it's the live system. I repeat, it's not happening all the time, it's happening once in hour or two, while service is calling the url every 5 minutes. – manda Oct 13 '15 at 07:17

0 Answers0