technical details
Microsoft.Data.SqlClient version: 5.1.0
.NET target: Framework 4.8.1
SQL Server version: SQL Server 2019
We are seeing seeing the error below as of 12/03.
The problem is intermittent:
- it starts as soon as the server boots up
- it is resolved by rebooting as well and 9/10 the problem is gone
We are aware that the encryption is nowadays the default and we can "mitigate" the problem by adding TrustServerCertificate=True to the connection string.
We don't want to do this obviously as the server's identity isn't verified and we could as well be talking securely with a man in the middle.
The intermittency of the problem sets it apart from all the other github issues that have the same error signature.
Sometimes the certificate is trusted, sometimes not.
We think the client comes up and is initialized in a bad state and not trusting the sql server self singed certificate that is signed by a authority that part of the Trusted Root Certification Authorities on the client.
In fact, when we open the .crt file that corresponds with the sql certificatie on the client while it is in the bad state, and thus show the below error, the .crt is said to be ok/trusted (?).
We have also tried restarting a number of windows services that could be related to certificate checking thinking that restarting them would get the client out of the bad state.
The client VM's are located in Azure.
We decoded the certificate that is attached binary in the event logged by System as it says in "The attached data contains the server certificate". This certificate is the one we expect: valid and if opened it is said to be ok as well.
How would we go about further troubleshooting this issue?
Thank you
Log Name: System
Source: Schannel
Date: 3/17/2023 1:53:42 PM
Event ID: 36882
Task Category: None
Level: Error
Keywords:
User: redacted
Computer: redacted
Description:
The certificate received from the remote server was issued by an untrusted certificate authority. Because of this, none of the data contained in the certificate can be validated. The TLS connection request has failed. The attached data contains the server certificate.
void Main()
{
string str = "Data Source=x;Encrypt=true";
string qs = "SELECT 1";
CreateCommand(qs, str);
}
private static void CreateCommand(string queryString,
string connectionString)
{
using (SqlConnection connection = new SqlConnection(
connectionString))
{
SqlCommand command = new SqlCommand(queryString, connection);
command.Connection.Open();
command.ExecuteNonQuery();
}
}
technical details
Microsoft.Data.SqlClient version: 5.1.0
.NET target: Framework 4.8.1
SQL Server version: SQL Server 2019
We are seeing seeing the error below as of 12/03.
The problem is intermittent:
We are aware that the encryption is nowadays the default and we can "mitigate" the problem by adding TrustServerCertificate=True to the connection string.
We don't want to do this obviously as the server's identity isn't verified and we could as well be talking securely with a man in the middle.
The intermittency of the problem sets it apart from all the other github issues that have the same error signature.
Sometimes the certificate is trusted, sometimes not.
We think the client comes up and is initialized in a bad state and not trusting the sql server self singed certificate that is signed by a authority that part of the Trusted Root Certification Authorities on the client.
In fact, when we open the .crt file that corresponds with the sql certificatie on the client while it is in the bad state, and thus show the below error, the .crt is said to be ok/trusted (?).
We have also tried restarting a number of windows services that could be related to certificate checking thinking that restarting them would get the client out of the bad state.
The client VM's are located in Azure.
We decoded the certificate that is attached binary in the event logged by System as it says in "The attached data contains the server certificate". This certificate is the one we expect: valid and if opened it is said to be ok as well.
How would we go about further troubleshooting this issue?
Thank you
Log Name: System
Source: Schannel
Date: 3/17/2023 1:53:42 PM
Event ID: 36882
Task Category: None
Level: Error
Keywords:
User: redacted
Computer: redacted
Description:
The certificate received from the remote server was issued by an untrusted certificate authority. Because of this, none of the data contained in the certificate can be validated. The TLS connection request has failed. The attached data contains the server certificate.