User Instance login flag is not allowed when connecting to a SQL Server instance: Solved

While working with an ASP.NET MVC application I encountered following exceptions:

clip_image002

Exception clearly says that user instance login flag is not allowed when connecting to a SQL Server instance. For sure this error is related to SQL Server instance I am working on in this particular application. I examined the connection string in the web.config file.

clip_image003

There are two important points about this connection string:

  1. It points to local SQL Server database.
  2. User Instance is set to true

All local database runs under user instance and hence they don’t allow to configure user instance value in the web.config file. Removing User Instance entry should solve this problem. I modified connection string as follows:

clip_image001

And changing this resolved the issue. Hope it helps.