Dummy Dummy - 1 year ago 146
C# Question

Login failed for user "This operation requires a connection to the 'master' database

Login failed for user and Its not just login

"This operation requires a connection to the 'master' database. Unable
to create a connection to the 'master' database because the original
database connection has been opened and credentials have been removed
from the connection string. Supply an unopened connection.

I've tried almost all the solutions that are available on web but nothing is helping me to get out of this problem.

The code was working fine on my last machine. when I moved the code to the new machine its started giving me this issue.

Given are my two connection strings

<add name="MNew" connectionString="Data Source=HP\SQL2014;
Initial Catalog=MNew;
Persist Security Info=True;
providerName="System.Data.SqlClient" />

and for Entity frame work

<add name="MNewEntities" connectionString="metadata=res://*/EntityModel.Model1.csdl|res://*/EntityModel.Model1.ssdl|res://*/EntityModel.Model1.msl;provider=System.Data.SqlClient;
provider connection string=&quot;
data source=HP\SQL2014;
initial catalog=MNew;
integrated security=True;
providerName="System.Data.EntityClient" />

Answer Source

I've no idea what was wrong in this one I update VS2015 and set the connection strings again and now it started working. I believe It was either because I Update the VS or May be Some thing else But its working now

 <add name="MNew"
 connectionString="data source=HP\SQL2014;       
  initial catalog=MNew;         
  integrated security=True;       
  MultipleActiveResultSets=True;" providerName="System.Data.SqlClient" />
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download