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.

Published by

Dhananjay Kumar

Dhananjay Kumar is Developer Evangelist for Infragistics. He is a 8 times Microsoft MVP and well respected Developer Advocate in India.He is the author of 900+ Blog Posts, and can often be found speaking around India at conferences and hosting free workshops for programmers across the country. So far, he has hosted 60 free workshops on various topics like JavaScript, Angular, WCF, ASP.NET MVC, C#, Azure etc. Follow him on twitter @debug_mode for all the updates about his blog posts and workshops. You can send him email at debugmode [at] outlook [dot] com

One thought on “User Instance login flag is not allowed when connecting to a SQL Server instance: Solved”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s