Error when attempting to use SQL 2016 LocalDb on Win 10 workstation

Mick-3237 21 Reputation points
2023-05-25T16:07:13.04+00:00

Hi,

My customer is attempting to use SQL 2016 LocalDB by installing the .msi file and then connecting through entity frameworks. This solution works fine on all but four of his workstations. On the workstations that are functioning correctly, he can connect to (LocalDb)\MSSQLLocalDB using SSMS. When attempting to connect on these four workstations, he receives the error below. We've tried disabling antivirus and another tool that we thought might interfere. Can anyone provide some guidance?

“Error occurred when attempting to start a result processing session. Additional error details: System.InvalidOperationException: This operation requires a connection to the 'master' database. Unable to create a connection to the 'master' database because the original database connection has been opened and credentials have been removed from the connection string. Supply an unopened connection. ---> System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 56 - Unable to load the SQLUserInstance.dll from the location specified in the registry. Verify that the Local Database Runtime feature of SQL Server Express is properly installed.) ---> System.ComponentModel.Win32Exception: %1 is not a valid Win32 application”.

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,695 questions
{count} votes

Accepted answer
  1. Erland Sommarskog 100.9K Reputation points MVP
    2023-05-30T21:07:07.8966667+00:00

    So the localdb instance works, but the connection from .NET does not. And, well, it says Unable to load the SQLUserInstance.dll from the location specified in the registry. So that suggests that something is broken on those machines. I don't know the gory details here, but maybe you should make comparisons between the file system and the registry between a broken machine and a healthy one. Maybe the registry has been tampered with. Maybe the file is missing from disk?

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. AniyaTang-MSFT 12,311 Reputation points Microsoft Vendor
    2023-05-26T07:27:32.0566667+00:00

    Hi @Mick-3237

    I found a similar thread, maybe you can use it as a reference: https://learn.microsoft.com/en-us/answers/questions/465081/i-tried-to-connect-to-localdb-with-vs-2019-and-i-c.

    For more information about SQL Server Express LocalDB, you can check this link; https://learn.microsoft.com/en-us/sql/database-engine/configure-windows/sql-server-express-localdb?view=sql-server-ver16.

    Best regards,

    Aniya

    0 comments No comments