簡體   English   中英

告訴ConfigurationManager忽略App.config部分

[英]Tell ConfigurationManager to ignore App.config section

我的App.config文件標記為:

<configuration>
    <configSections>
        <section name="Custom" type="…" />
    </configSections>
    <Custom>
        ...
    </Custom>
    <Ignored>
        ...
    </Ignored>
</configuration>

所以,我有一個配置文件,其中:

  • 一節(“Custom”)由API處理,我為它編寫了ConfigurationSection繼承者
  • 第二部分(“忽略”)我將自己解析,因為Configuration API不讓我解決我的任務。

當我運行程序時,異常發生“無法識別的配置部分'忽略'”。

我是否有可能告訴ConfigurationManager忽略此部分“忽略”?

您可以將以下內容添加到<configSections>元素:

<section name="Ignored" type="System.Configuration.IgnoreSection, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM