I have hibernate.cfg.xml included in my WCF service library with
BuildAction = Content and Copy to output directory = Copy Always
However, when I run the application it is throwing following error:
Could not find file 'C:\Program Files (x86)\DevExpress 2010.2\IDETools\System\CodeRush\Bin\PlugIns\hibernate.cfg.xml'
I am not sure why it is looking for hibernate.cfg.xml at above path instead of run-time bin directory.
FYI: I have recently installed DevExpress v10.2 to be used in another application.
Any ideas?
One option is to move your nHibernate configuration into the web.config
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
...
</session-factory>
</hibernate-configuration>
In your configsections
section add
<configuration>
<configSections>
<section name="hibernate-configuration" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" requirePermission="false" />
...
<configSections>
<configuration>
Another option is to try this (untested in wcf)
var cfg = new Configuration();
cfg.Configure(Path.Combine(AppDomain.CurrentDomain.BaseDirectory,"hibernate.cfg.xml"));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With