title: ASP.NET MVC database can not access
body: <p>I download a open source MVC project and I can not run it. The author mentioned in the memo that I should change the database owner to myself. But I don't know how to do it. And I can not see the database in the SQL server Object explorer.</p>
  
  <blockquote>
    <p>An exception of type 'System.Data.Entity.Core.ProviderIncompatibleException' occurred in EntityFramework.dll but was not handled in user code</p>
    
    <p>Additional information: An error occurred accessing the database. 
    This usually means that the connection to the database failed. Check that the connection string is correct and that the appropriate DbContext constructor is being used to specify it or find it in the application's config file. </p>
    
    <p>See <a href="http://go.microsoft.com/fwlink/?LinkId=386386" rel="noreferrer">http://go.microsoft.com/fwlink/?LinkId=386386</a> for information on DbContext and connections. See the inner exception for details of the failure.</p>
  </blockquote>
  
  <p>The error pointed here </p>
  
  <pre><code>public override TEntity ReadOne(ISpecification&lt;TEntity&gt; spec) {
      return this.set.Where(spec.IsSatisfied).FirstOrDefault();
  }
  </code></pre>
  
  <p><code>web.config</code>:</p>
  
  <pre><code>&lt;connectionStrings&gt;
      &lt;add name="mvcForum.DataProvider.MainDB" connectionString="Data Source=SERVERNAMEorSERVERNAME\INSTANCE;Initial Catalog=DBNAME;User ID=USER;password=PASSWORD"/&gt;
      &lt;!--add name="mvcForum.DataProvider.MainDB" connectionString="Data Source=.\SQL2008r2Express;Initial Catalog=mvcforum;User ID=test;password=test;" providerName="System.Data.SqlClient" /&gt;--&gt;
      &lt;!--&lt;add name="User.MongoDB" connectionString="mongodb://localhost/mvcforum" /&gt;--&gt;
  &lt;/connectionStrings&gt;
  </code></pre>