I want to connect my Homepage to an Access-DB. For that I use:
- .NET Framework 4.72 API
- EntityFrameworkProvider.Jet
When I try to run it I receave following message
System.ArgumentException: The ADO.NET provider with invariant name 'JetEntityFrameworkProvider' is either not registered in the machine or application config file, or could not be loaded. Zeile 24: var result = from Daten_ALT in context.Sammlung Zeile 25: select Daten_ALT;
This snippet in my homecontroller.cs loks like this:
using Sammler_Homepage.Models;
using System.Linq;
using System.Web.Mvc;
namespace Sammler_Homepage.Controllers
{
public class HomeController : Controller
{
public ActionResult SammlungView()
{
Sammlung SammlungSQL = new Sammlung();
ContextDB context = new ContextDB();
var result = from Daten_ALT in context.Sammlung
select Daten_ALT;
foreach (Sammlung sammlung in result)
{
SammlungSQL.Nummer = sammlung.Nummer;
}
ViewBag.Message = SammlungSQL;
ViewBag.Title = "SammlungView";
return View();
}
}
}
my ContextDB.cs:
using System.Data.Entity;
using Microsoft.Ajax.Utilities;
using Microsoft.EntityFrameworkCore;
namespace Sammler_Homepage.Models
{
public class ContextDB : DbContext
{
public ContextDB() : base("DefaultConnection")
{
}
public DbSet<Sammlung> Sammlung { get; set; }
}
}
My packages.config (reduced to significant part):
<packages xmlns="urn:packages">
<package id="EntityFramework" version="6.4.4" targetFramework="net472" />
<package id="EntityFrameworkCore.Jet" version="2.2.0" targetFramework="net472" />
<package id="Microsoft.EntityFrameworkCore" version="3.1.8" targetFramework="net472" />
<package id="Microsoft.EntityFrameworkCore.Abstractions" version="3.1.8" targetFramework="net472" />
<package id="Microsoft.EntityFrameworkCore.Analyzers" version="3.1.8" targetFramework="net472" />
<package id="Microsoft.EntityFrameworkCore.Design" version="3.1.8" targetFramework="net472" developmentDependency="true" />
<package id="Microsoft.EntityFrameworkCore.Relational" version="3.1.8" targetFramework="net472" />
<package id="Remotion.Linq" version="2.2.0" targetFramework="net472" />
</packages>
And the web.config (reduced to significant part):
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<appSettings>
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<connectionStrings>
<!--add name="DefaultConnection" connectionString="Provider=Microsoft.ACE.OleDB.12.0; Data source=C:\...\AKneu.mdb" providerName="JetEntityFrameworkProvider" /-->
<add name="DefaultConnection" connectionString="Data source=C:\...\AKneu.mdb" providerName="JetEntityFrameworkProvider" />
<!--add name="DefaultConnection" connectionString="Data source=C:\...\AKneu.mdb" providerName="EntityFrameworkProvider.Jet" /-->
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.7.2" />
<httpRuntime targetFramework="4.7.2" />
</system.web>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="mssqllocaldb" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
<!--provider invariantName="EntityFrameworkCore.Jet" type="Microsoft.EntityFrameworkCore.Jet, Microsoft.EntityFrameworkCore"/-->
<!--provider invariantName="JetEntityFrameworkProvider" type="JetEntityFrameworkProvider.JetProviderServices, JetEntityFrameworkProvider"/-->
</providers>
</entityFramework>
</configuration>
As you see, the commets were ways where I tried to solve it. But it didn't help. Do you have any suggestions? Is it because of Linq?