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

Could not load file or assembly 'NHibernate',该如何解决

2012-02-12 
Could not load file or assembly NHibernateCouldnotloadfileorassemblyNHibernateoroneofitsdependenc

Could not load file or assembly 'NHibernate'
Could   not   load   file   or   assembly   'NHibernate '   or   one   of   its   dependencies.   The   parameter   is   incorrect.   (Exception   from   HRESULT:   0x80070057   (E_INVALIDARG))  

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.FileLoadException:   Could   not   load   file   or   assembly   'NHibernate '   or   one   of   its   dependencies.   The   parameter   is   incorrect.   (Exception   from   HRESULT:   0x80070057   (E_INVALIDARG))

Source   Error:  

An   unhandled   exception   was   generated   during   the   execution   of   the   current   web   request.   Information   regarding   the   origin   and   location   of   the   exception   can   be   identified   using   the   exception   stack   trace   below.    

Assembly   Load   Trace:   The   following   information   can   be   helpful   to   determine   why   the   assembly   'NHibernate '   could   not   be   loaded.

===   Pre-bind   state   information   ===
LOG:   User   =   STEVEN\stevenli
LOG:   DisplayName   =   NHibernate
  (Partial)
LOG:   Appbase   =   file:///D:/Work/sourcecode/paybill/PayBill.UI.Web/
LOG:   Initial   PrivatePath   =   D:\Work\sourcecode\paybill\PayBill.UI.Web\bin
Calling   assembly   :   System.Web,   Version=2.0.0.0,   Culture=neutral,   PublicKeyToken=b03f5f7f11d50a3a.
===
LOG:   This   bind   starts   in   default   load   context.
LOG:   Using   application   configuration   file:   D:\Work\sourcecode\paybill\PayBill.UI.Web\web.config
LOG:   Using   machine   configuration   file   from   C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG:   Policy   not   being   applied   to   reference   at   this   time   (private,   custom,   partial,   or   location-based   assembly   bind).
LOG:   Attempting   download   of   new   URL   file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary   ASP.NET   Files/paybill.ui.web/f55ce66e/1fe116e6/NHibernate.DLL.
LOG:   Attempting   download   of   new   URL   file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary   ASP.NET   Files/paybill.ui.web/f55ce66e/1fe116e6/NHibernate/NHibernate.DLL.
LOG:   Attempting   download   of   new   URL   file:///D:/Work/sourcecode/paybill/PayBill.UI.Web/bin/NHibernate.DLL.
LOG:   Using   application   configuration   file:   D:\Work\sourcecode\paybill\PayBill.UI.Web\web.config
LOG:   Using   machine   configuration   file   from   C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG:   Post-policy   reference:   NHibernate,   Version=1.0.2.0,   Culture=neutral,   PublicKeyToken=154fdcb44c4484fc


ERR:   Failed   to   complete   setup   of   assembly   (hr   =   0x80070057).   Probing   terminated.

 


[解决办法]
web.config写错了?
[解决办法]
估计你使用NHibernate.dll,
估计也使用了反射,你把DLL文件复制在bin目录下,同时这个DLL文件也要包含相关的DLL也要复制
或者把它们都加入到GAC中,这样估计就可以了
[解决办法]
看起来是相关的Dll没有拷贝到同一个目录下。除了NHibernate.dll,还有Log4Net,Ant什么的,一堆东西。
[解决办法]
castle的?添加nhibernate的引用

热点排行