ASP.NET MVC database cannot access

I am downloading an open source MVC project and I cannot start it. The author mentioned in the memo that I should change the owner of the database myself. But I do not know how to do this. And I do not see the database in the SQL Server object explorer.

An exception of type "System.Data.Entity.Core.ProviderIncompatibleException" occurred in EntityFramework.dll, but was not processed in the user code

Additional information: an error occurred while accessing the database. This usually means that the connection to the database failed. Ensure that the connection string is correct and that the appropriate DbContext constructor is used to specify or search the application configuration file.

See http://go.microsoft.com/fwlink/?LinkId=386386 for information on DbContext and connections. For more information about the failure, see Internal Exception.

The error indicated here

public override TEntity ReadOne(ISpecification<TEntity> spec) {
    return this.set.Where(spec.IsSatisfied).FirstOrDefault();
}

web.config:

<connectionStrings>
    <add name="mvcForum.DataProvider.MainDB" connectionString="Data Source=SERVERNAMEorSERVERNAME\INSTANCE;Initial Catalog=DBNAME;User ID=USER;password=PASSWORD"/>
    <!--add name="mvcForum.DataProvider.MainDB" connectionString="Data Source=.\SQL2008r2Express;Initial Catalog=mvcforum;User ID=test;password=test;" providerName="System.Data.SqlClient" />-->
    <!--<add name="User.MongoDB" connectionString="mongodb://localhost/mvcforum" />-->
</connectionStrings>
+4
source share
1 answer

You need to change the connection string, the easiest way is to open the server explorer in visual studio, and then add a new connection after creating a connection to your database, copy and paste the connection string from the properties window

+11
source

Source: https://habr.com/ru/post/1537202/


All Articles