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

时间:2011-02-15 13:55:47

标签: asp.net .net-4.0 c#-4.0 entity-framework-4

当我尝试在我的服务器上发布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

2 个答案:

答案 0 :(得分:1)

您应该在服务器上安装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文件夹中。

答案 1 :(得分:0)

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

相关问题