Nhibernate - C#无法找到请求的.Net Framework数据提供程序。它可能没有安装

时间:2016-09-09 19:34:14

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

error throw

当我从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

2 个答案:

答案 0 :(得分:0)

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

我猜你只需要安装正确的提供商。检查项目中的引用以查看是否有任何丢失的dll等等。也许在新PC上的GAC中没有安装dll?

编辑:查看答案here,我认为您只需要遵循这些解决方案。

答案 1 :(得分:0)

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