【问题标题】:Unhandled Exception: System.Configuration.ConfigurationErrorsException: Unrecognised element 'services'. Nested ConfigurationElementCollection未处理的异常:System.Configuration.ConfigurationErrorsException:无法识别的元素“服务”。嵌套的 ConfigurationElementCollection
【发布时间】:2010-01-22 17:49:41
【问题描述】:

我在 App.Config 中有以下 configSection。

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="servicesConfig" type="Admin.Config.ServicesConfig, TestConsole"/>
  </configSections>
  <servicesConfig>
    <serviceGroups>
      <services group="group1">
        <add name="Service1" host="localhost"/>
        <add name="Service2" host="localhost"/>
      </services>
      <services group="groups">
        <add name="Service1" host="localhost"/>
        <add name="Service2" host="localhost"/>
      </services>
    </serviceGroups>
  </servicesConfig>
</configuration>

这已映射到 c# 中的以下类

http://pastie.org/1538533

我收到以下错误

未处理的异常:System.Configuration.ConfigurationErrorsException:无法识别的元素“服务”。

【问题讨论】:

    标签: .net configuration app-config


    【解决方案1】:
    public class Service : ConfigurationElement
    

    将服务更改为服务

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-15
      • 1970-01-01
      • 2020-07-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-01-17
      • 2011-11-14
      相关资源
      最近更新 更多