Search This Blog

Wednesday, January 5, 2011

ASP.NET MVC 2.0 NHibernate Configure() issue

Programmer Question

Hi Stackoverflow,
I have installed NHibernate for my ASP.NET web app although I'm getting a problem in real-time on the following line of code:



            if (_sessionFactory == null)
{
_sessionFactory = new Configuration().Configure().BuildSessionFactory();

}


Looking at the inner exception the problem is this:



{"Could not find file 'D:\Websites\Test\Test\Test\bin\hibernate.cfg.xml'.":"D:\Websites\Test\Test\Test\bin\hibernate.cfg.xml"}



This makes sense, as the file doesnt exist in that location. This line of code is within my Core project. File hibernate.cfg.xml is currently in my Infrastucture project, not my Core. Should this be? I have copied the file into this location although I still get problems. If I manually copy the file into this location within windows explorer I then get the following error during runtime.
{"Could not load file or assembly 'Infrastructure' or one of its dependencies. The system cannot find the file specified.":"Infrastructure"}



Also, I'm missing DynamicProxy.dll as I'm using castle and I couldnt see a version of the DynamicProxy in the castle folder that I downloaded from http://sourceforge.net/projects/nhibernate/



any suggestions? I can see LinFu.DynamicProxy.dll within the download although it says I only need one of the folders, Linfu or Castle, and I'm using Castle for this experiment. Not sure if this has anything to do with it, just thought it might help.



any ideas? Many thanks,
James



Find the answer here

No comments:

Post a Comment

Related Posts with Thumbnails