Question

When my IIS MVC4 Web App (running as my user) tries to connect to a named LocalDb Instance it fails to start MyInstance or connect to it.

I have the auto-create section in my Web.config and App.config of another services that uses the same database.

I then manually create and start my named instance using SqlLocalDb create MyInstance -s I try again and get the same error.

If I then do SqlLocalDb info, it shows 2 instances with the same name.

If I stop and delete MyInstance, then there will only be 1 instance in the info list.

That one instance cannot be interacted with.

Doing SqlLocalDB info MyInstance or start MyInstance or delete MyInstance will all say that the instance does not exist, but it is still in the info list.

I have looked everywhere on the Internet for someone else with this problem and cannot find it.

P.S. People that are going to suggest this gets moved to dba.stackexchange.com: LocalDB is for developers, not DBAs.

Was it helpful?

Solution

I never found an explanation for this, but the "ghost" instance, as I call it, comes from duplicate instances with that name owned by another user or artifacts of previous instances left in the Registry. If multiple instances show up in the list with the same name, you would have to manually log in as all users who have ever created LocalDb instances on your machine and stop and remove their instances. In some cases this is not enough. You also have to remove their Registry entries under the UserInstance section(s) of the Registry. It would be really nice to have a LocalDb management tool that can manage all users, but this does not exist. I have to use PsExec for service accounts.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top