How to fix connectivity issue between asp.net web ( On prem ) to azure sql

Anil Babu Ravi 5 Reputation points
2023-08-10T14:20:25.3266667+00:00

Microsoft.Data.SqlClient.SqlException (0x80131904): An error occurred while sending the request. ---> System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> 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.

Azure SQL Database
{count} votes

1 answer

Sort by: Most helpful
  1. Alberto Morillo 34,651 Reputation points MVP
    2023-08-10T14:50:53.81+00:00

    Please make sure the connection string has the following settings included:

    Encrypt=True;TrustServerCertificate=True;Connection Timeout=30;"
    

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.