views:

59

answers:

1

I am deploying Asp.Net MVC 2 application on Windows Server 2003. I am using NHibernate for data access.

When I deployed this application on Windows server 2003 and browse to it the application throws an exception saying "hibernate.cfg.xml not found under Windows/System32/inetsrv."

Why NHibernate is searching Windows/System32/inetsrv rather than loading "hibernate.cfg.xml" from the bin folder?

Thanks

+1  A: 

I'm guessing that your app is looking for the file in the webapp root.

When nhibernate loads your config file you need to set the path to config file with Server.MapPath(@"~/bin/nhibernate.cfg.xml").

Mule
Hi All,I tried doing Server.MapPath(@"bin\nhibernate.cfg.xml")it is not giving any problem for my Root path but when i change page it is throwing error System.IO.DirectoryNotFoundExceptionMessage=Could not find a part of the path 'E:\Applications \source\UserInterface\Accounts\bin\hibernate.cfg.xml'.I dont know why is the accounts folder here. Why it is searching in Accounts folder i dont have any Accounts folder.Please help
Your app most likely has an accounts controller and its trying to access your Accounts views for some reason. Is the controller loading the nhibernate config file?
Mule
Yes. I am having accounts controller and i was trying to access Accounts View.I am loading the nhibernate config file Session method and giving call to this methd from Controller.Thanks
Ok, try changing the config file path to ~/bin/nhibernate.cfg.xml.
Mule
Hi Mule,I tried your suggestion.Thanks