开发者

ASP.NET MVC 2.0 NHibernate Configure() issue

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开发者_JS百科. Not sure if this has anything to do with it, just thought it might help.

any ideas? Many thanks, James


About "Could not find hibernate.cfg.xml": you can either set it to "Copy to Output" (see this) or configure it as an embedded resource.

About "Could not load assembly Infrastructure": you're missing Infrastructure.dll in your bin, or one of its dependencies, just as the error says.

About missing DynamicProxy.dll: if you're using NHibernate 3.x all you need to use the Castle bytecode provider is NHibernate.ByteCode.Castle.dll and Castle.Core.dll

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜