【问题标题】:Nhibernate - C# Unable to find the requested .Net Framework Data Provider. It may not be installedNhibernate - C# 找不到请求的 .Net Framework 数据提供程序。它可能没有安装
【发布时间】:2016-09-09 19:34:14
【问题描述】:

当我从 PC 迁移到另一台新 PC 时,我收到了这个错误。谁能帮帮我?

*我正在使用 Nhibernate,ASP.NET MVC

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.Common.DbProviderFactories.GetFactory(String
providerInvariantName) +1279138   
NHibernate.Driver.ReflectionBasedDriver..ctor(String
providerInvariantName, String driverAssemblyName, String
connectionTypeName, String commandTypeName) +196   
NHibernate.Driver.MySqlDataDriver..ctor() +66

[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, StackCrawlMark& stackMark) +138   
System.Activator.CreateInstance(Type type, Boolean nonPublic) +105   
System.Activator.CreateInstance(Type type) +12   
NHibernate.Connection.ConnectionProvider.ConfigureDriver(IDictionary`2
settings) +180

[HibernateException: Could not create the driver from
NHibernate.Driver.MySqlDataDriver.]   
NHibernate.Connection.ConnectionProvider.ConfigureDriver(IDictionary`2
settings) +429   

NHibernate.Connection.ConnectionProviderFactory.NewConnectionProvider(IDictionary`2
settings) +467   
NHibernate.Cfg.SettingsFactory.BuildSettings(IDictionary`2 properties)
+985    NHibernate.Cfg.Configuration.BuildSettings() +30    NHibernate.Cfg.Configuration.BuildSessionFactory() +50   
gta.app.web.NHibernateSession.OpenSession(List`1 psHBMList) in

d:\Project\lianhuat\gta.app.web\Models\NHibernate\NHibernateSession.cs:22
gta.app.web.Controllers.SystemController.getT9010ById(String Password)
in d:\Project\lianhuat\gta.app.web\Controllers\SystemController.cs:965
gta.app.web.Controllers.SystemController.Login(DataSourceRequest
poRequest, String kdpUserID, String kdpPassword) in
d:\Project\lianhuat\gta.app.web\Controllers\SystemController.cs:980   
lambda_method(Closure , ControllerBase , Object[] ) +238   
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext
controllerContext, IDictionary`2 parameters) +229   

System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext
controllerContext, ActionDescriptor actionDescriptor, IDictionary`2
parameters) +35   
System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__36(IAsyncResult
asyncResult, ActionInvocation innerInvokeState) +39   
System.Web.Mvc.Async.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult
asyncResult) +67   

System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult
asyncResult) +42   
System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3c()
+72    System.Web.Mvc.Async.<>c__DisplayClass45.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3e()
+386    System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult
asyncResult) +42   
System.Web.Mvc.Async.<>c__DisplayClass28.<BeginInvokeAction>b__19()
+38    System.Web.Mvc.Async.<>c__DisplayClass1e.<BeginInvokeAction>b__1b(IAsyncResult
asyncResult) +186   

System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult
asyncResult) +38   
System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult
asyncResult, ExecuteCoreState innerState) +29   
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult
asyncResult) +65   
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +53
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult
asyncResult) +36    System.Web.Mvc.Controller.EndExecute(IAsyncResult
asyncResult) +38   
System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__4(IAsyncResult
asyncResult, ProcessRequestState innerState) +44   
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult
asyncResult) +65   
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)
+38    System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
+657    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +146

【问题讨论】:

    标签: c# asp.net-mvc iis nhibernate


    【解决方案1】:

    我很确定该错误意味着您的web.config 中连接字符串上的providerName 属性的值不正确,或者实际上没有安装提供程序。

    我猜你只需要安装正确的提供程序。检查项目中的引用,看看是否缺少dll等。也许新PC上的GAC中没有安装dll?

    编辑:查看答案here,我想你只需要按照这些来解决。

    【讨论】:

      【解决方案2】:

      我得到了答案,我已经安装了 mysql 连接器 .net 后问题解决了。谢谢大家

      【讨论】:

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