实体框架错误 - 无法找到请求的 .Net Framework 数据提供程序。可能没有安装

发布于 2024-10-17 09:08:56 字数 2855 浏览 1 评论 0原文

当我尝试在我的服务器上发布 ASP.NET 4.0 应用程序时,出现此错误。我使用实体框架和mysql作为数据库。任何帮助将不胜感激。谢谢 !

Unable to find the requested .Net Framework Data Provider.  It may not be installed.

[ArgumentException: Unable to find the requested .Net Framework Data Provider.  It may not be installed.]
   System.Data.EntityClient.EntityConnection.GetFactory(String providerString) +251

[ArgumentException: The specified store provider cannot be found in the configuration, or is not valid.]
   System.Data.EntityClient.EntityConnection.GetFactory(String providerString) +10983191
   System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString) +641
   System.Data.Objects.ObjectContext.CreateEntityConnection(String connectionString) +67
   Satelite.Dados.sateliteEntities..ctor() in E:\Sites_dotNet4.0\satelite\trunk\Sistema\Dados\Satelite.Designer.cs:64

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0
   System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache) +117
   System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache) +247
   System.Activator.CreateInstance(Type type, Boolean nonPublic) +106
   System.Web.DynamicData.<>c__DisplayClass2.<RegisterContext>b__1() +15
   System.Web.DynamicData.MetaModel.RegisterContext(Func`1 contextFactory, ContextConfiguration configuration) +483
   Satelite.Global.RegisterRoutes(RouteCollection routes) in E:\Sites_dotNet4.0\satelite\trunk\Sistema\Satelite\Global.asax.cs:35

[HttpException (0x80004005): Exception has been thrown by the target of an invocation.]
   System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +3988565
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +191
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +325
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +407
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +375

[HttpException (0x80004005): Exception has been thrown by the target of an invocation.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11529072
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +141
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4784373

I get this error when I try to publish a asp.net 4.0 application on my server. I am using entity framework and mysql as the database. Any help will be much appreciated. Thanks !

Unable to find the requested .Net Framework Data Provider.  It may not be installed.

[ArgumentException: Unable to find the requested .Net Framework Data Provider.  It may not be installed.]
   System.Data.EntityClient.EntityConnection.GetFactory(String providerString) +251

[ArgumentException: The specified store provider cannot be found in the configuration, or is not valid.]
   System.Data.EntityClient.EntityConnection.GetFactory(String providerString) +10983191
   System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString) +641
   System.Data.Objects.ObjectContext.CreateEntityConnection(String connectionString) +67
   Satelite.Dados.sateliteEntities..ctor() in E:\Sites_dotNet4.0\satelite\trunk\Sistema\Dados\Satelite.Designer.cs:64

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0
   System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache) +117
   System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache) +247
   System.Activator.CreateInstance(Type type, Boolean nonPublic) +106
   System.Web.DynamicData.<>c__DisplayClass2.<RegisterContext>b__1() +15
   System.Web.DynamicData.MetaModel.RegisterContext(Func`1 contextFactory, ContextConfiguration configuration) +483
   Satelite.Global.RegisterRoutes(RouteCollection routes) in E:\Sites_dotNet4.0\satelite\trunk\Sistema\Satelite\Global.asax.cs:35

[HttpException (0x80004005): Exception has been thrown by the target of an invocation.]
   System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +3988565
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +191
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +325
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +407
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +375

[HttpException (0x80004005): Exception has been thrown by the target of an invocation.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11529072
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +141
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4784373

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

逆光飞翔i 2024-10-24 09:08:56

您应该在服务器上安装 mysql 数据提供程序或在 web.config 中添加如下内容:

<system.data>
    <DbProviderFactories>
      <remove invariant="System.Data.SQLite" />
      <add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".Net Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite, Version=1.0.66.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
    </DbProviderFactories>
  </system.data>

为 SQLite 数据库添加提供程序的示例。
然后您应该检查 MySQL 数据提供程序 Dll 是否位于服务器上的 Bin 文件夹中。

You should install mysql data provider on server or add in web.config something like this:

<system.data>
    <DbProviderFactories>
      <remove invariant="System.Data.SQLite" />
      <add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".Net Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite, Version=1.0.66.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
    </DbProviderFactories>
  </system.data>

It sample of adding provider for SQLite database.
Then you should check that MySQL data provider Dll is in Bin folder on server.

人心善变 2024-10-24 09:08:56

您只需要数据提供者。我在使用 Oracle 11g 时遇到了同样的问题,在安装了他们的数据提供程序后,它就工作了。尽管我不得不重新启动网络应用程序几次,但第一次拍摄时没有成功。

You simply need the data provider. I had the same problem with Oracle 11g and after installing their data provider it worked. Didn't work on the first shot though I had to restart the web app a few times.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文