首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

NHibernate的有关问题

2012-03-27 
NHibernate的问题小弟我刚接触NHibernate遇到一问题,实在没则,所以请教各位达人赐教.privateNHibernate.Cf

NHibernate的问题
小弟我刚接触NHibernate遇到一问题,实在没则,所以请教各位达人赐教.
private   NHibernate.Cfg.Configuration   cfg;

        ///   <summary>
        ///   构建一个Session工厂。
        ///   </summary>
        private   void   BuildSessionFactory()
        {
                cfg   =   new   NHibernate.Cfg.Configuration();
                string   connectString   =   AppConfigSingleton.GetAppConfigSingleton().GetConfigValue( "ConnectionString ");
                  //加载数据实体
                cfg.SetProperty( "hibernate.connection.connection_string ",   connectString);

               
                string   assembly   =   AppConfigSingleton.GetAppConfigSingleton().GetConfigValue( "LoadDataLayerAssembly ");

                string[]   assemblys   =   assembly.Split(new   char[]   {   ', '   });

                for   (int   i   =   0;   i   <   assemblys.Length;   i++)
                {
                        cfg.AddAssembly(assemblys[i]);
                }
                sessions   =   cfg.BuildSessionFactory();
编译程序没有问题,但是在运行时老是抛出这个错误:
Could   not   load   file   or   assembly   'log4net,   Version=1.2.9.0,   Culture=neutral,   PublicKeyToken=b32731d11ce58905 '   or   one   of   its   dependencies.   系统找不到指定的文件。  
Description:   An   unhandled   exception   occurred   during   the   execution   of   the   current   web   request.   Please   review   the   stack   trace   for   more   information   about   the   error   and   where   it   originated   in   the   code.  

Exception   Details:   System.IO.FileNotFoundException:   Could   not   load   file   or   assembly   'log4net,   Version=1.2.9.0,   Culture=neutral,   PublicKeyToken=b32731d11ce58905 '   or   one   of   its   dependencies.   系统找不到指定的文件。

Source   Error:  


Line   93:           private   void   BuildSessionFactory()
Line   94:           {
Line   95:                   cfg   =   new   NHibernate.Cfg.Configuration();//错误地方在这里
Line   96:                   string   connectString   =   AppConfigSingleton.GetAppConfigSingleton().GetConfigValue( "ConnectionString ");
Line   97:                   try

这是为什么我的web-config有log4net节点啊!!!


[解决办法]
看一下项目中的引用,


然后看到有一个Nhiberante
然后点他,查看他的属性
其中有一个复制本地,将他设定为True
[解决办法]
没有 log4net.bll

你需要再web。config中配置一下

热点排行