2016-09-09 50 views
0

error throwNhibernate - C#無法找到所需的.Net框架數據提供程序。它可能不會安裝

當我從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 

回答

0

我敢肯定,錯誤意味着在連接字符串providerName屬性在你的web.config的值是不正確,或提供商從字面上看並沒有安裝。

我猜你只需要安裝正確的提供者。檢查項目中的參考,以查看是否有任何缺失的dll等等。也許有沒有在新PC上安裝GAC的dll?

編輯:看答案here,我想你只需要按照這些解決方案。

相關問題