7

I have Microsoft SQL Server 2019 Developer edition installed on my computer for local development work with .NET. Everything was working well as of two months ago, when I was last working on a project that was using it. I'm finally getting back to the project, but now my program is failing with the following error: "Internal connection fatal error. Error state 15, Token: 23 (System.Data)". The program uses a SQL Server authentication account.

I get the same error with SQL Server Management Studio (SSMS) when I try to connect to the database instance. It's a saved session to localhost\MSSQL2019 which used to work. I get the error whether I use my Windows account or a SQL account.

I updated SSMS to the latest (18.12.1) and still get the error. I also confirmed the IP settings via the configuration manager.

In frustration, I uninstalled MSSQL 2019 Dev edition, rebooted and tried to reinstall it with a fresh download of the DVD ISO from Microsoft. The installation gets close to the end, but fails with the same error.

I am able to successfully install MSSQL 2016 Dev edition and connect via SSMS. However, when I try to upgrade it to 2019, the upgrade completes, but SSMS gets the error again.

I'm on Windows 10 Pro 21H2, 64-bit, with an Intel i7 processor.

I haven't had any luck with Google or Bing to find a solution to this. Any help is appreciated.

For completeness, here's the full exception.

===================================

Testing the registered server failed. Verify the server name, 
login credentials, and database, and then click Test again.

===================================

Internal connection fatal error. Error state: 15, Token : 23 (System.Data)

------------------------------
Program Location:

   at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK)
   at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover, Boolean isFirstTransparentAttempt, Boolean disableTnir)
   at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout)
   at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance)
   at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling, SqlAuthenticationProviderManager sqlAuthProviderManager)
   at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
   at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions)
   at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
   at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
   at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
   at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
   at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
   at System.Data.SqlClient.SqlConnection.Open()
   at Microsoft.SqlServer.Management.RegisteredServers.NewRegisteredServerForm.testConnection_Click(Object sender, EventArgs e)
1
  • @nateirvin No, I'm not using linked servers.
    – Andy S.
    Commented Sep 23, 2022 at 13:14

5 Answers 5

5

Encountered the same issue but it is gone since I uninstalled windows update KB5011048

0
2

I ran into this issue and through a combination of efforts I managed to resolve it.

  1. Run all the uninstallers through Powershell using the following commands twice.
$products = Get-CimInstance -Query "SELECT * FROM Win32_Product WHERE (Caption LIKE '%SQL Server 2022%')"
foreach ($product in $products) {
    $guid = $product.IdentifyingNumber
    Write-Host "Uninstalling $($product.Caption) with GUID $guid"
    Start-Process -Wait "msiexec.exe" -ArgumentList "/x $guid"
}
  1. Running the uninstall for SQL Server from control panel made it realise it was already uninstalled and removed it from the listing.

  2. Clearing the Installation paths

  • "C:\Program Files\Microsoft SQL Server"
  • "C:\Program Files (x86)\Microsoft SQL Server"
  1. Clearing the registry of these keys
  • Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server
  • Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer
  • Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Microsoft SQL Server
  • Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\MSSQLServer
  1. Restarting

  2. Running sfc /scannow & dism /online /cleanup-image /restorehealth

  3. Restarting (Again)

  4. Using CCleaner to clear out old registry entries

  5. Uninstalling KB5011048

  6. And finally Restarting

The install then proceeded normally.

1

My colleagues spent ages trying to sort this one out. Also tried removing KB5011048 as mentioned above, but it was a full reinstall of the whole PC that finally got it working.

1
  • We have seen the problem even on a clean windows build. Commented Dec 5, 2023 at 4:28
0

This problem reappeared in VS2022 after upgrading from VS2019. After spending 2 days trying to find the connection problem, I decided to try VS2019 to publish the same project. VS2019 worked. My database is local, not in the Azure cloud.

This db connection problem has migrated to VS2022. I do not upgrade VS for minor "enhancements", so the above update did not affect me until now. I am using VS2022 - 17.6.4.

VS 2019 - 16.11.26 does not have the problem. I suspect the VS team is attempting to naïvely connect to the cloud. And btw, they do this synchronously with a long/indefinate timeout so it is a PITA, requiring killing VS with task manager.

At least now I have a workaround using my old VS2019 for this database-first project.

0

For me the problem was that I had enabled TLS 1.3 on my system with Windows 10, while Windows 10 does not actually support TLS 1.3. So the solution was to disable TLS 1.3 (either via the registry like I did, or with a tool like IISCrypto)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.