简体   繁体   English

ConfigurationManager.GetSection 不继承自 System.Configuration.IConfigurationSectionHandler

[英]ConfigurationManager.GetSection does not inherit from System.Configuration.IConfigurationSectionHandler

in a project .netstandard 2.0 I receive this exception在 .netstandard 2.0 项目中,我收到此异常

System.Configuration.ConfigurationErrorsException: 'An error occurred creating the configuration section handler for mySection: Type 'Custom.Config.Configurator' does not inherit from 'System.Configuration.IConfigurationSectionHandler'. System.Configuration.ConfigurationErrorsException:“为 mySection 创建配置节处理程序时出错:类型“Custom.Config.Configurator”不继承自“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.在项目位于 .NET 框架之前,似乎 System.Configuration.ConfigurationManager 无法正常工作,并且可以正常工作。 I installed System.Configuration.ConfigurationManager 6.0.0.0 and the IConfigurationSectionHandler is implemented.我安装了 System.Configuration.ConfigurationManager 6.0.0.0 并实现了 IConfigurationSectionHandler。

After troubling two days I put the code of System.Configuration.ConfigurationManager.GetSection("mySection");经过两天的困扰,我把System.Configuration.ConfigurationManager.GetSection("mySection"); in .NET framework project.在 .NET 框架项目中。

Likely System.Configuration and System.Configuration.ConfigurationManager don't work together very well System.Configuration 和 System.Configuration.ConfigurationManager 可能不能很好地协同工作

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ConfigurationManager.GetSection和Configuration.GetSection有什么区别? - What is Difference between ConfigurationManager.GetSection and Configuration.GetSection? ReadOnlyNameValueCollection(从ConfigurationManager.GetSection读取) - ReadOnlyNameValueCollection (reading from ConfigurationManager.GetSection) ConfigurationManager.GetSection()函数 - ConfigurationManager.GetSection() function 为什么ConfigurationManager.GetSection“ system.webServer / handlers”不可用? - Why is the ConfigurationManager.GetSection “system.webServer/handlers” not available? ConfigurationManager.GetSection跳过重复项 - ConfigurationManager.GetSection Skips Duplicates ConfigurationManager.GetSection 返回 null - ConfigurationManager.GetSection returns null ConfigurationManager.GetSection给出错误“无法从程序集加载类型...” - ConfigurationManager.GetSection Gives Error “Could not load type…from assembly…” 为什么使用ConfigurationManager.GetSection会导致“SecurityException:Request failed”,但ConfigurationManager.OpenExeConfiguration却没有? - Why does using ConfigurationManager.GetSection cause “SecurityException: Request failed” but ConfigurationManager.OpenExeConfiguration does not? ConfigurationSection ConfigurationManager.GetSection()始终返回null - ConfigurationSection ConfigurationManager.GetSection() always returns null 使用 System.Configuration.ConfigurationManager.GetSection 从 App.config 文件中获取值会将 \\ 添加到任何 \\ 字符 - Getting a value from App.config file using System.Configuration.ConfigurationManager.GetSection will add \\ to any \\ characters
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM