【问题标题】:Entity Framework Error - Unable to find the requested .Net Framework Data Provider. It may not be installed实体框架错误 - 找不到请求的 .Net Framework 数据提供程序。它可能没有安装
【发布时间】:2014-06-06 21:07:45
【问题描述】:

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

【问题讨论】:

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


    【解决方案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 文件夹中。

    【讨论】:

      【解决方案2】:

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2014-02-05
        • 1970-01-01
        相关资源
        最近更新 更多