Unhandled exception: System.Configuration.ConfigurationErrorsException: Unrecognized elements of 'services'. Nested Configuration ElementCollection

I have the following configSection in App.Config.

<?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>

This maps to the following classes in C #

http://pastie.org/1538533

I get the following error

Unhandled exception: System.Configuration.ConfigurationErrorsException: Unrecognized element 'services'.

+3
source share
1 answer
public class Service : ConfigurationElement

change Service to services .

+1
source

Source: https://habr.com/ru/post/1729604/


All Articles