【问题标题】:custom configuration provider is not loaded with exception自定义配置提供程序未加载异常
【发布时间】:2017-07-03 23:02:13
【问题描述】:

我正在使用link 中提到的自定义配置提供程序。

我的应用配置如下:

<configuration>
    <configSections>    
        <section name="log4net" type="ClassLibrary2.Class1,ClassLibrary2"/>
    </configSections>
    <log4net configProtectionProvider="XMLConfigProvider.XMLConfigProvider,XMLConfigProvider">
    <EncryptedData>
        <sectionInfo name ="log4net"></sectionInfo>
    </EncryptedData>
</configuration>

我已将 dll XMLConfigProvider 放在调用应用程序以及 gac 中。我仍然收到错误:

加载配置文件时出错:找不到保护提供程序。

【问题讨论】:

    标签: c# .net log4net app-config


    【解决方案1】:

    不会像这个错字那么简单吧?

    “XMLConfigProvider.XMLCpnfigProvider”

    编辑:没有

    好的,看这里:http://msdn.microsoft.com/en-us/library/ms254494.aspx

    configProtectionProvider 属性的值似乎是指节中的名称,是提供者本身的类型名称。

    【讨论】:

    • nope :) ,它在命名类时打错了......它是一个试验项目,因此没有为纠正类名而烦恼;)
    • 好的,那肯定会做到的。像这样在您的问题中设置陷阱是不公平的;-) 如果不是这样,那听起来像是大会地点问题。是否确保提供者在同一个项目中或目标项目有对提供者的引用?
    • 已编辑帖子以获取更多信息 - 看起来您需要一个 configProtectedData 部分。
    • 嘿,非常感谢史蒂夫! configProtectedData 部分有效:)
    【解决方案2】:

    也许

    XMLConfigProvider
    

    而不是

    XMLCpnfigProvider
    

    【讨论】:

    • 好的...如上所述,这是类名,拼写错误。但是为了避免混淆,对其进行了纠正。问题依旧
    猜你喜欢
    • 1970-01-01
    • 2022-08-02
    • 1970-01-01
    • 1970-01-01
    • 2019-01-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-23
    相关资源
    最近更新 更多