We are using LocalDb for integration/unit testing of a .NET Core application. I have been using this solution for months and recently started getting sporadic errors. It seems to happen the first time the tests try to execute a linked server query. The linked server query is hitting another database on the same LocalDb instance on my local machine, i.e. there is not really a remote connection happening. I am at a loss of how else to troubleshoot.
To set up the linked server connection, we are doing a simple SP call, nothing has changed with this from when it was working consistently.
EXEC sp_addlinkedserver @server='{ServerName}'
- Encryption not supported on the client
.
Test{redacted} Aborted: Exit code is -532462766 (Unhandled exception. System.Data.SqlClient.SqlException (0x80131904): Encryption not supported on the client.
OLE DB provider "SQLNCLI11" for linked server "(localdb)\MSSQLLocalDB" returned message "A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.".
OLE DB provider "SQLNCLI11" for linked server "(localdb)\MSSQLLocalDB" returned message "Client unable to establish connection".
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite, String methodName)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
{redacted}
- A similar stack track with an SSL credentials error
Exception Info: System.Data.SqlClient.SqlException (0x80131904): SSL Provider: No credentials are available in the security package