我在我的WCF服务库中包含了hibernate.cfg.xml
BuildAction = Content and Copy to output directory = Copy Always
但是,当我运行应用程序时,它会抛出以下错误:
Could not find file 'C:\Program Files (x86)\DevExpress 2010.2\IDETools\System\CodeRush\Bin\PlugIns\hibernate.cfg.xml'
我不确定为什么它在上面的路径而不是运行时bin目录中寻找hibernate.cfg.xml.
仅供参考:我最近安装了DevExpress v10.2以用于其他应用程序.
有任何想法吗?
Rip*_*ppo 17
一种选择是将nHibernate配置移动到web.config中
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
...
</session-factory>
</hibernate-configuration>
Run Code Online (Sandbox Code Playgroud)
在你的configsections部分添加
<configuration>
<configSections>
<section name="hibernate-configuration" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" requirePermission="false" />
...
<configSections>
<configuration>
Run Code Online (Sandbox Code Playgroud)
另一个选择是尝试这个(在wcf中未经测试)
var cfg = new Configuration();
cfg.Configure(Path.Combine(AppDomain.CurrentDomain.BaseDirectory,"hibernate.cfg.xml"));
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
12584 次 |
| 最近记录: |