c# – “更新到NHibernate 3.2后,无法找到所请求的.Net Framework数据提供程序”

我使用NHibernate 3.1,我更新到3.2版.我也使用confOrm 1.0.1.5并更新到2.0.0.0vVersion.我的Firebird NET Provider版本是2.7.我对我的代码进行了一些修改,因为confOrm不再包含ConfOrm.Mapper.当我尝试执行选择时,它返回以下错误:

NHibernate.HibernateException : Could not create the driver from NHibernate.Driver.FirebirdClientDriver, NHibernate, Version=3.2.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4.
  ----> System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation.
  ----> System.ArgumentException : Unable to find the requested .Net Framework Data Provider.  It may not be installed.
at NHibernate.Connection.ConnectionProvider.ConfigureDriver(IDictionary`2 settings)
at NHibernate.Connection.ConnectionProviderFactory.NewConnectionProvider(IDictionary`2 settings)
at NHibernate.Cfg.SettingsFactory.BuildSettings(IDictionary`2 properties)
at NHibernate.Cfg.Configuration.BuildSettings()
at NHibernate.Cfg.Configuration.BuildSessionFactory()
at SoftManager.Dao.Util.SessionManager.get_factory() in SessionManager.cs: line 15
at SoftManager.Dao.Util.SessionManager.getSession() in SessionManager.cs: line 23
at SoftManager.Dao.GenericDao`1.findUniqueByWhere(Restricao rest, Order order) in GenericDao.cs: line 144
at SoftManager.Dao.CidadeDao.findUniqueByWhere(Restricao rest, Order order) in CidadeDao.cs: line 52
at SoftManager.Teste.TesteConsulta.consultaCidade2() in TesteConsulta.cs: line 52
at SoftManager.Teste.TesteConsulta.testes() in TesteConsulta.cs: line 17
--TargetInvocationException
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, ref Boolean canBeCached, ref RuntimeMethodHandleInternal ctor, ref Boolean bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at NHibernate.Bytecode.ActivatorObjectsFactory.CreateInstance(Type type)
at NHibernate.Connection.ConnectionProvider.ConfigureDriver(IDictionary`2 settings)
--ArgumentException
at NHibernate.Driver.ReflectionBasedDriver..ctor(String providerInvariantName, String driverAssemblyName, String connectionTypeName, String commandTypeName)
at NHibernate.Driver.FirebirdClientDriver..ctor()

任何帮助表示赞赏,谢谢!

最佳答案 我用Google搜索了你的错误,然后来到
this thread on Social MSDN.总结解决方案(向下滚动Barrett的解决方案),你的machine.config文件中可能有些不对劲.该用户在他的machine.config中报告了一个额外的结束标记,如下所示:

<!-- notice the double closing tag -->
<system.data>
    <DbProviderFactories>
        <add name="Odbc Data Provider" invariant="System.Data.Odbc" ... />
        <add name="OleDb Data Provider" invariant="System.Data.OleDb" ... />
        <add name="OracleClient Data Provider" invariant="System.Data ... />
        <add name="SqlClient Data Provider" invariant="System.Data ... />
        <add name="IBM DB2 for i .NET Provider" invariant="IBM.Data ... />
        <add name="Microsoft SQL Server Compact Data Provider" ... /></DbProviderFactories>
    <DbProviderFactories/>
</system.data>

顺便说一句,我用google搜索Unable to find the requested .Net Framework Data Provider. It may not be installed.,这是报告错误中更有趣的部分.如果以上内容没有帮助,还有更多有趣的发现.

稍微进一步的研究将我带到this blog post,这解释了为什么在有多个数据提供器的情况下这可能是一个问题,以及如何解决它.注意:此StackOverflow questionthis one相关(解决方案也在machine.config中).

点赞