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();