SQL Server LocalDB instance fails to start (automatically)

entity-framework-core sql-server sql-server-2014-localdb

Question

I have a WPF application which is connecting to the SQL Server 2014 Express LocalDB (i.e. a local .mdf database file).

The application uses the Entity Framework Core library version 7.0.0-rc1-final.

This is the connection string that I am using:

data source=(LocalDb)\InstanceLocalDB; Initial Catalog = MyAppDB; Integrated Security=True; MultipleActiveResultSets=True; Connection Timeout = 10

I do the installation of the SQL Server LocalDB during the application's setup. The same goes for the creation and starting of the SqlLocalDB Instance, which is performed with this command:

SqlLocalDB.exe create "SqlLocalDBInstance"
SqlLocalDB.exe start "SqlLocalDBInstance"

The app runs successfully on approximately 50 PCs, but fails on two as follows:

At first, the application successfully communicates with the database, but after awhile, if there is no activity, the instance is stopping automatically (after about 10 minutes), and from then it fails to reconnect again, which result in these following error:

Your SQL Server installation is either corrupt or has been tampered with (unknown package id).

On starting the LocalDB instance manually using the same command line mentioned above:

SqlLocalDB.exe start "SqlLocalDBInstance"

the application successfully communicates with the DB, until the next time the LocalDB instance is stopping, and so on.

Windows logs shows this following error:

Windows API call WaitForMultipleObjects returned error code: 575.
Windows system error message is: {Application Error} The application was unable to start correctly (0x%lx). Click OK to close the application.

SQL LocalDB log files provided this notification message:

The RANU instance is terminating in response to its internal time out. This is an informational message only. No user action is required.

I have installed and re-installed all over again (both Microsoft SQL Server 2014 Express as well as deleted the .mdf and .ldf files), and keep getting the same error.

I noticed that in both of problematic machines the UAC was turned off; so I tried to reproduce the issue on test machines with the UAC turned off - there wasn't any reproduction of the problem.

The 2 problematic machines runs under Windows 10 pro 64bit.

Finally, after further investigation, i found a workaround by renaming the application folder or by changing its location.

How I recognized the solution?

I have relocated the whole application folder (with all of its binaries) outside of the "C:\Program Files (x86)"

directory into other directory within the "C:\" path, and the problem has gone.

In the same manner, I moved the application folder back to its original location; only now I changed the

name of the application folder, and it worked again.

Maybe the issue is somehow related to the directory permissions.

Nevertheless, i did these steps below, but without any success:

  1. Unchecked the 'Read-only' option for the folder's Attribute.

  2. Enabled all 'Security' permissions for the application folder.

Note: I'm working in an organization domain with all kinds of custom policies...

My next move is to use some utility tool to extract all the permissions of the application folder, and then to try to trace the root of the problem. Can you suggest me some tools for this?

1
2
7/3/2018 8:44:27 AM

Popular Answer

At last I Found the root of the problem.

The issue was with the Compatibility mode of the application's executable file, that was set to "Run this program in compatibility mode for: Windows 8" (under the 'Compatibility' tab within the file's Properties).

Once I removed (unchecked) this option, the error has gone, and the issue was finally closed for me.

1
7/4/2018 7:37:20 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow