Share via

Error with SQLServer

Anonymous
2024-01-25T17:03:52.6533333+00:00

I am using visual studio 2022 and i am trying to update my database with .NET, the build is succeeding however, towards the end I get this error and it doesn't work: 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: 50 - Local Database Runtime error occurred. Error occurred during LocalDB instance startup: SQL Server process failed to start. what could be the cause of this? Am I missing a configuration file or an extension/tool. I tried to run the SQLServer from services, since it wasn't running before. This gave me an error, I've uninstalled and reinstalled SQL Expr 2022 a few times to no avail.

SQL Server | Other

3 answers

Sort by: Most helpful
  1. Erland Sommarskog 133.9K Reputation points MVP Volunteer Moderator
    2024-01-26T18:22:30.0366667+00:00

    The error log has this message:

    2024-01-26 09:57:14.76 spid23s There have been 256 misaligned log IOs which required falling back to synchronous IO. The current IO is on file C:\Program Files\Microsoft SQL Server\MSSQL16.SQLEXPRESS01\MSSQL\Template Data\master.mdf.

    This is a known issue where Windows 11 for some disk drives reports a sector size that SQL Server does not cope with. Microsoft has published an article with workarounds for the problem.

    Your setup has not completed, so your Express instance is likely to be half-baked. Then again, once you have applied the instructions in the article, localdb may work. (But I don't know for sure that it will.)

    0 comments No comments

  2. ZoeHui-MSFT 41,551 Reputation points
    2024-01-26T06:08:11.78+00:00

    Hi @Thomas Gillanders - STUDENT,

    First please make sure that you have installed SQL Server successfully.

    You may connect to the server locally for a try or follow the steps to check.

    Click Start, point to All Programs, point to Microsoft SQL Server, point to Configuration Tools, and then click SQL Server Configuration Manager.

    If you do not have these entries on the Start menu, SQL Server is not correctly installed. Run Setup to install the SQL Server Database Engine.

    If you have already installed SQL Server, please follow the documentation to troubleshooting.

    Regards,

    Zoe Hui


    If the answer is helpful, please click "Accept Answer" and upvote it.

    0 comments No comments

  3. Michael Taylor 61,221 Reputation points
    2024-01-25T20:44:12.1566667+00:00

    The error indicates you have a bad connection string to the database. Please show us the connection string your application is using.

    SQL Express is really not used anymore. If you install Visual Studio 2017 (maybe even earlier) or higher then it automatically installs a local, non-service, instance of SQL called LocalDB. This is the instance that you generally develop against. In SQL Server Object Explorer you can see your LocalDB instance. If you are also creating a SQL Project for your database then it shows up as well. This LocalDB instance is run only while VS is debugging your code. You can get the connection string to use by right clicking the database in SQL Server Object Explorer and viewing the properties.

    If you are running your own SQL Server instance (Developer edition is free) then that will be installed as a service. You need to ensure the service is running. Then ensure your connection string is using that SQL Server instance. You can get that information from SQL Server Management Studio.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.