【发布时间】:2011-03-29 00:35:34
【问题描述】:
通过将配置数据放在 web.config 中,我在几个 Web 应用程序中使用 Castle Windsor。
所以当我决定在 Windows 服务中使用它时,我认为这很容易。我的 app.config 文件如下所示:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="castle" type="Castle.Windsor.Configuration.AppDomain.CastleSectionHandler,Castle.Windsor" />
</configSections>
...various other stuff...
<castle>
<components>
...component listings...
</components>
</castle>
</configuration>
我正在像这样创建我的容器:
WindsorContainer windsorContainer = new WindsorContainer(new XmlInterpreter());
但疯狂的是,当应用程序运行时,我得到了
Could not find section 'castle' in the configuration file associated with this domain.
at Castle.Core.Resource.ConfigResource..ctor(String sectionName)
at Castle.Core.Resource.ConfigResource..ctor()
at Castle.Windsor.Configuration.Interpreters.AbstractInterpreter..ctor()
at Castle.Windsor.Configuration.Interpreters.XmlInterpreter..ctor()
...application stack trace...
我有点迷糊了。有人有什么建议吗?
干杯
大卫
【问题讨论】:
标签: .net configuration castle-windsor app-config