我刚刚将硬盘和操作系统从 XP更改为Win7 。 在我的源代码位于 D:驱动器之前,现在它们位于相同文件夹结构下的 F:。
问题在于FluentNhibernate配置。我得到以下InvalidOperationException StackTrace:
at FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory() in d:\Builds\FluentNH-v1.x-nh3\src\FluentNHibernate\Cfg\FluentConfiguration.cs:line 115
at TSI_Manager.FNH_Manager.CreateSessionFactory() in F:\.....
正如您所看到的,它尝试访问 D: ..我不知道究竟是什么尝试访问了什么。但是查看我的项目参考,所有参考(系统...除外)都是 F:,并设置为复制本地=真。
那么仍然指的是 D:?我错过了哪些步骤?
喝彩!
修改 例外细节:
System.InvalidOperationException was unhandled
Message=An error occurred creating the form. See Exception.InnerException for details. The error is: An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException for more detail.
Source=TSI Manager
StackTrace:
at TSI_Manager.My.MyProject.MyForms.Create__Instance__[T](T Instance) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 190
at TSI_Manager.My.MyProject.MyForms.get_MainForm()
at TSI_Manager.My.MyApplication.OnCreateMainForm() in F:\My Jotta\VB\Projects VS2010\IB API Projects\9.64.16\ClientManager\v0004 Changing ActiveUser\TSI Manager\My Project\Application.Designer.vb:line 35
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at TSI_Manager.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: FluentNHibernate.Cfg.FluentConfigurationException
Message=An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException for more detail.
Source=FluentNHibernate
StackTrace:
at FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory() in d:\Builds\FluentNH-v1.x-nh3\src\FluentNHibernate\Cfg\FluentConfiguration.cs:line 115
at TSI_Manager.FNH_Manager.CreateSessionFactory() in F:\My Jotta\VB\Projects VS2010\IB API Projects\9.64.16\ClientManager\v0004 Changing ActiveUser\TSI Manager\DAL\FnhManager.vb:line 43
at TSI_Manager.FNH_Manager.ConfigureSessionFactory(String connectionStr) in F:\My Jotta\VB\Projects VS2010\IB API Projects\9.64.16\ClientManager\v0004 Changing ActiveUser\TSI Manager\DAL\FnhManager.vb:line 18
at TSI_Manager.MainBL.InitializeDatabase() in F:\My Jotta\VB\Projects VS2010\IB API Projects\9.64.16\ClientManager\v0004 Changing ActiveUser\TSI Manager\Generic\MainBL.vb:line 174
at TSI_Manager.MainBL..ctor() in F:\My Jotta\VB\Projects VS2010\IB API Projects\9.64.16\ClientManager\v0004 Changing ActiveUser\TSI Manager\Generic\MainBL.vb:line 92
at TSI_Manager.MainForm..ctor() in F:\My Jotta\VB\Projects VS2010\IB API Projects\9.64.16\ClientManager\v0004 Changing ActiveUser\TSI Manager\GUI\Forms\MainForm.vb:line 6
InnerException: NHibernate.HibernateException
Message=Could not create the driver from NHibernate.Driver.SQLite20Driver, NHibernate, Version=3.0.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4.
Source=NHibernate
StackTrace:
at NHibernate.Connection.ConnectionProvider.ConfigureDriver(IDictionary`2 settings) in d:\CSharp\NH\nhibernate\src\NHibernate\Connection\ConnectionProvider.cs:line 116
at NHibernate.Connection.ConnectionProvider.Configure(IDictionary`2 settings) in d:\CSharp\NH\nhibernate\src\NHibernate\Connection\ConnectionProvider.cs:line 64
at NHibernate.Connection.ConnectionProviderFactory.NewConnectionProvider(IDictionary`2 settings) in d:\CSharp\NH\nhibernate\src\NHibernate\Connection\ConnectionProviderFactory.cs:line 50
at NHibernate.Cfg.SettingsFactory.BuildSettings(IDictionary`2 properties) in d:\CSharp\NH\nhibernate\src\NHibernate\Cfg\SettingsFactory.cs:line 83
at NHibernate.Cfg.Configuration.BuildSettings() in d:\CSharp\NH\nhibernate\src\NHibernate\Cfg\Configuration.cs:line 1687
at NHibernate.Cfg.Configuration.BuildSessionFactory() in d:\CSharp\NH\nhibernate\src\NHibernate\Cfg\Configuration.cs:line 1239
at FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory() in d:\Builds\FluentNH-v1.x-nh3\src\FluentNHibernate\Cfg\FluentConfiguration.cs:line 108
InnerException: System.Reflection.TargetInvocationException
Message=Exception has been thrown by the target of an invocation.
Source=mscorlib
StackTrace:
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache)
at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at NHibernate.Bytecode.ActivatorObjectsFactory.CreateInstance(Type type) in d:\CSharp\NH\nhibernate\src\NHibernate\Bytecode\ActivatorObjectsFactory.cs:line 9
at NHibernate.Connection.ConnectionProvider.ConfigureDriver(IDictionary`2 settings) in d:\CSharp\NH\nhibernate\src\NHibernate\Connection\ConnectionProvider.cs:line 107
InnerException: System.ArgumentException
Message=Unable to find the requested .Net Framework Data Provider. It may not be installed.
Source=System.Data
StackTrace:
at System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName)
at NHibernate.Driver.ReflectionBasedDriver..ctor(String providerInvariantName, String driverAssemblyName, String connectionTypeName, String commandTypeName) in d:\CSharp\NH\nhibernate\src\NHibernate\Driver\ReflectionBasedDriver.cs:line 49
at NHibernate.Driver.SQLite20Driver..ctor() in d:\CSharp\NH\nhibernate\src\NHibernate\Driver\SQLite20Driver.cs:line 28
InnerException:
答案 0 :(得分:1)
实际上并没有尝试访问D :(据我们所知) - 它只是认为这是BuildSessionFactory的源代码所在。你可以自己重建FluentNHibernate,但是我不认为这是问题的根源。
查看异常的消息是什么 - 这可能会提供更多信息。
答案 1 :(得分:0)
我认为关键问题是带有消息的InnerException:
无法找到请求的.Net Framework数据提供程序。它可能没有安装。
您需要在新计算机上将相关数据提供程序安装到GAC,或确保在项目中正确引用它。
似乎可以从以下网址获取最新版本的SQLite提供程序: