简体   繁体   中英

ConfigurationManager.GetSection does not inherit from System.Configuration.IConfigurationSectionHandler

in a project .netstandard 2.0 I receive this exception

System.Configuration.ConfigurationErrorsException: 'An error occurred creating the configuration section handler for mySection: Type 'Custom.Config.Configurator' does not inherit from 'System.Configuration.IConfigurationSectionHandler'.

when I use

System.Configuration.ConfigurationManager.GetSection("mySection");

The section is the following

<section name="mySection" type="Custom.Config.Configurator, Custom" />

It seems the System.Configuration.ConfigurationManager doesn't work as I expected, before the project was in .NET framework and it worked. I installed System.Configuration.ConfigurationManager 6.0.0.0 and the IConfigurationSectionHandler is implemented.

After troubling two days I put the code of System.Configuration.ConfigurationManager.GetSection("mySection"); in .NET framework project.

Likely System.Configuration and System.Configuration.ConfigurationManager don't work together very well

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM