You are trying to use a section group as a collection, and sections are used as elements in the collection for which they are not intended, therefore, an error.
point.Services , - , , . :
Config
<configSections>
<section name="point.Services"
type="xyz.Point.Messaging.PointServiceConfiguration.PointServices, Barcap.FIA.Point.Messaging" />
</configSections>
<point.Services>
<xServices>
<xService name="Service1" type="IService" >
<endpoints>
<endpoint aliasName="incoming" endpointName="Subscriber"/>
<endpoint aliasName="outgoing" endpointName="Publisher"/>
</endpoints>
</xService>
<xService name="BlobService" type="IPortfolioService" >
<endpoints>
<endpoint aliasName="incoming" endpointName="Subscriber"/>
<endpoint aliasName="outgoing" endpointName="Publisher"/>
</endpoints>
</xService>
</xServices>
</point.Services>
:
public class PointServices : ConfigurationSection
{
public static PointServices Get()
{
return (PointServices) ConfigurationManager.GetSection("point.Services");
}
[ConfigurationProperty("xServices", IsDefaultCollection = true)]
[ConfigurationCollection(typeof(PointService), AddItemName = "xService")]
public PointServicesCollection Services
{
get { return (PointServicesCollection) base["xServices"]; }
}
}
public class PointService : ConfigurationElement
{
[ConfigurationProperty("name", IsRequired = true)]
public string Name
{
get { return this["name"].ToString(); }
}
[ConfigurationProperty("type", IsRequired = true)]
public string Type
{
get { return this["type"].ToString(); }
}
[ConfigurationProperty("endpoints", IsRequired = false)]
[ConfigurationCollection(typeof(EndpointAlias), AddItemName = "endpoint")]
public EndpointAliasCollection Endpoints
{
get { return (EndpointAliasCollection) this["endpoints"]; }
}
}
:
- PointServices - , < point.Services > , Get()
- PointServices Services, PointServiceCollection, - PointService (NOT PointServices) xService
- PointService - , , , ,
, .