Open Closed

Cannot connect to my local SQL database #7308


User avatar
0
alper created
Support Team Director

When I try to run DbMigrator, it doesn't create the localdb. I get the below exception:

Unhandled exception. Microsoft.Data.SqlClient.SqlException (0x80131904): 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: SNI_PN11, error: 52 - Unable to locate a Local Database Runtime installation. Verify that SQL Server Express is properly installed and that the Local Database Runtime feature is enabled.) ---> System.ComponentModel.Win32Exception (2): The system cannot find the file specified.


1 Answer(s)
  • User Avatar
    1
    alper created
    Support Team Director

    This happens either because you don't have SQL Server Local DB installation or you have a different SQL Server instance name.

    First; install SQL Server Local DB from this address. Basically, you need to download SQL Server Express and run the setup, it'll extract the files into your local disk. Later, search SqlLocalDB.msi in the extracted folder. Run this MSI file.

    Second; clean your local db instance name by running the following commands in the SQL Local DB installation folder. My installation directory is C:\Program Files\Microsoft SQL Server\160\Tools\Binn

    sqllocaldb stop mssqllocaldb
    sqllocaldb delete mssqllocaldb
    sqllocaldb start "MSSQLLocalDB"
    

Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09