title: First chance exception of 'System.Data.EntityException'. The underlying provider failed on Open
body: <p>I've been given a site that was created by someone else and I'm now trying to test it. I can compile the system without any problems but when I try to log in to the website, I get the error: </p>
  
  <p><code>"EntityException occured. A first chance exception of type 'System.Data.EntityException' occured in System.Data.Entity.dll. Additional info: The underlying provider failed on Open."</code></p>
  
  <p>Furthermore, if I dig deeper, I see an InnerException of <code>Cannot open database \"MyDB\" requested by the login. The login failed. Login failed for user 'name\\owner'.</code></p>
  
  <p>I've read similar problems on the web and it seems like its a problem with database connections? I've tried multiple 'solutions' that include messing around with the connectionString but nothing works.</p>
  
  <p>What I think the system wants to do is connect to a .mdf located in a separate project's App_Data. Anyway, here's the connectionString code that I received originally:</p>
  
  <pre><code>add name="NameServiceContext"
  connectionString="Server=tcp:qiu5vg5yhv.database.windows.net,1433;Database=MyDB;User ID=MYID;Password=MYPASS;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;"
  providerName="System.Data.SqlClient"
  </code></pre>
  
  <p>Quick question, what is the tcp:...... stuff? I'm assuming it was generated somehow, but how?</p>
  
  <p>I've tried 'fixing' the problem and ended up with something like this:</p>
  
  <pre><code>add name="NameServiceContext" 
  connectionString="data source=./SQLEXPRESS;AttachDbFilename=C:\Users\owner\Documents\MyERP\App_Data\MyDB.mdf;Integrated Security=True;Connect Timeout=30;" 
  providerName="System.Data.SqlClient"
  </code></pre>
  
  <p>Both methods give the same errors and I'm out of ideas. How would I go about fixing this?</p>
  
  <p>Also, when I connect to a db via tools>connect to database > MS SQL db file, I get an option between 2 data sources, <code>./SQLEXPRESS</code> and <code>(LocalDB)\v11.0</code>. Do I have to include both of them? If so, how?</p>