温莎城堡的配置文件 [英] configuration file of castle windsor

查看:49
本文介绍了温莎城堡的配置文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的配置文件的样子:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <!--<configSections>
    <section name="castle" type="Castle.Windsor.Configuration.AppDomain.CastleSectionHandler,Castle.Windsor" />
  </configSections>
  <castle>-->
    <components>
      <component id="BasicElement" service="ClassLibrary1.ISomething, ClassLibrary1"
                 type="ClassLibrary1s.Something, ClassLibrary1"
                 lifestyle="singleton">
      </component>
    </components>
  <!--</castle>-->
</configuration>

在F5中运行应用程序时出现错误:
配置系统初始化失败,内部异常告诉我:
无法识别的配置部分组件。

when I run my application in F5 i got the error: Configuration system failed to initialize, and the inner exception tells me: Unrecognized configuration section components.

我看到了它会因此调用文件 Interception.vshost.exe.Config
,尽管我明确要求他读取其他文件。

and i see that it consequentially call the file Interception.vshost.exe.Config although that I explicitly asked him to read other file.

推荐答案

您已注释掉configSection部分和Castle部分,仅留下了component部分。

You've commented out the configSection part and the castle parts leaving just the component section.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="castle" type="Castle.Windsor.Configuration.AppDomain.CastleSectionHandler,Castle.Windsor" />
  </configSections>
  <castle>
    <components>
    </components>
  </castle>
</configuration>

如果您想要一个空白的城堡配置,我会建议类似上面的内容。

If you want a blank castle configuration I would suggest something like the above.

这篇关于温莎城堡的配置文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆