如何解决“无法识别的配置部分休眠配置"?错误 ?. [英] How to resolve "Unrecognized configuration section hibernate-configuration" error ?.

查看:123
本文介绍了如何解决“无法识别的配置部分休眠配置"?错误 ?.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. 

Parser Error Message: Unrecognized configuration section hibernate-configuration. 



源错误:



Source Error:

<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
		<session-factory name="HospitalManagementSystem">
<property name="dialect">NHibernate.Dialect.MsSql2005Dialect</property>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>

<property name="connection.connection_string">Server="ADMIN";initial catalog=HM; User ID=sa; Password=zzz; Integrated Security=True</property>

<property name="proxyfactory.factory_class">
NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu
      </property></session-factory></hibernate-configuration>

推荐答案

似乎您没有在项目中添加"NHibernate" dll的引用.

请查看下面的链接以获取更多详细信息.
http://nhforge.org/wikis/howtonh/your-first-nhibernate-based- application.aspx

编辑-我刚刚意识到,上面的链接可能会向您显示错误页面,刷新页面后它便开始工作.
It seems like you haven''t added reference of "NHibernate" dll in your Project.

Have a look at below link for more details.
http://nhforge.org/wikis/howtonh/your-first-nhibernate-based-application.aspx

Edit - I just realized, above link may show you error page, After refreshing the page it gets working.


添加对nhibernate的引用后,请不要这么做"别忘了添加以下代码:
after you added reference to nhibernate, don''t forget to add this code:
<configuration>
   <!-- Add this element -->
   <configsections>
      <section>
         name="hibernate-configuration"
         type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate"
   />
</section></configsections>
   <!-- Add this element -->
   <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
      <session-factory>
         <property name="dialect">NHibernate.Dialect.MsSql2005Dialect</property>
         <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
         <property name="connection.connection_string">Server=localhost\SQLEXPRESS;initial catalog=quickstart;Integrated Security=True</property>
         <property name="proxyfactory.factory_class">NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu</property>
         <mapping assembly="QuickStart" />
      </session-factory>
   </hibernate-configuration>
   <!-- Leave the system.web section unchanged -->
   <system.web>
   ...
   </system.web>
</configuration>



确保您添加



make sure you add

<section>
name="hibernate-configuration"
type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate"
/> </section>

<configsections></configsections>

,然后您可以随意添加

<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2"></hibernate-configuration>


这篇关于如何解决“无法识别的配置部分休眠配置"?错误 ?.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆