Click here to Skip to main content
15,902,002 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Guys,

Hopefully, you are all fine, I have a problem with the starting ((
SQL Server (MSSQLSERVER)
)) when Windows 11 starts, it stops automatically I tried many ways to solve it. but it is still stopping.

I change (
NT Service\MSSQLSERVER
) to (Local System account). Although I changed it to (Local Service or Network Service), it is still stopping.

I use the code below, but it is also not working, it gives me an error. (
"Cannot open MSSQLSERVER service on computer '.'."
)

What I have tried:

1-
ServiceController service = new ServiceController("MSSQLSERVER");
            service.Start();


2-
ServiceController service = new ServiceController("MSSQLSERVER");

            if (service.Status == ServiceControllerStatus.Stopped)
            {
                service.Start();
            }


3-
System.Diagnostics.Process process = new System.Diagnostics.Process();
            process.StartInfo.FileName = "net start \"SQL Server (MSSQLSERVER)\"";
            process.Start();
Posted

1 solution

If SQL Server is shutting down immediately, that means that there is some problem with the installed version. Rather than trying different ways to start it, you should take a look at what SQL Server is telling you is the problem. To figure that out, you need to open up the event viewer (eventvwr). This contains the logged information about application processes. The details of what is going wrong will be present here. There may be multiple things wrong, so be prepared to go through multiple entries in the logs.
 
Share this answer
 
Comments
Maciej Los 9-May-24 16:05pm    
5ed!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900