Entity Framework data provider not found, entityclient

Firstly, I found many questions and many answers related or perceived identically to my problem, however, nothing works for me.

I have a new MVC4 boilerplate website, a new database in a new installation of SQL Server 2008 r2. I ran aspnet_regsql in the database and created all the tables. I created a .edmx model that generated the connection string in my web.config.

<connectionStrings> <add name="TestEntities" connectionString="metadata=res://*/Models.Test.csdl|res://*/Models.Test.ssdl|res://*/Models.Test.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=WEBSRV\SQLEXPRESS;initial catalog=Test;persist security info=True;user id=Test;password=Test#1337;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" /> </connectionStrings> 

Building a website returns me an error Unable to find the requested .Net Framework Data Provider. It may not be installed. Unable to find the requested .Net Framework Data Provider. It may not be installed.

My machine.config is missing self-closing <DbProviderFactories/> The same problem occurs when I launch a website locally on the visual studio web host or on my IIS web server. I did not install NuGet packages

Why am I getting this error?

+4
source share
2 answers

That's right, I understood the problem.

You cannot use this connection string for anything other than an edmx connection. The way I use it in my web.config makes the site use the same connection string for the membership element, which is incompatible with the System.Data.EntityClient provider and in this case needs System.Data.Sqlclient. Adding the second connection string, minus the Entity Framework material in it and having a link to the attributes of the membership provider in web.config, removes all errors and allows the page to display and request data from the SQL server.

A nightmare over, may return to work on my site. about/

+8
source

This is the wrong type of connection string. That is, for the first type of model (EDMX). You need a line of the first code of the code. Try using a standard connection string, for example:

  <connectionStrings> <add name="MyDbContext" providerName="System.Data.SqlClient" connectionString="Data Source=(local);Initial Catalog=your_database;Integrated Security=True;Application Name=your_app_name" /> </connectionStrings> 
+3
source

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


All Articles