【问题标题】:Is it possible to create custom config section with assembly in GAC是否可以在 GAC 中使用程序集创建自定义配置部分
【发布时间】:2017-02-20 13:50:31
【问题描述】:

我有一个 .NET 库,我将其 dll 放入 GAC。一个控制台应用程序正在使用此库并定义自定义配置部分。但它会引发异常

ConfigurationManager.getConfigSection("telemetry")

当库 dll 在 bin 文件夹中时,它可以正常工作。但是从 GAC 访问时会引发异常。为什么会这样。有什么线索吗?有没有办法解决这个问题。

我的配置部分定义为 -

<configSections>
 <section name="telemetry" type="Com.Example.Telemetry.TelemetryConfig,Com.Example.Telemetry Version=1.0.0.0,Culture=neutral,PublicKeyToken=f0c3520fdea11a5a" />
 </configSections>

【问题讨论】:

  • 您是如何在您的网络/应用配置中定义配置部分的?

标签: .net c#-4.0 app-config gac


【解决方案1】:

找出问题所在。

程序集名称和版本之间缺少逗号

<configSections>
<section name="telemetry" type="Com.Example.Telemetry.TelemetryConfig,Com.Example.Telemetry, Version=1.0.0.0,Culture=neutral,PublicKeyToken=f0c3520fdea11a5a" />
 </configSections>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-12-10
    • 2012-10-24
    • 2012-05-11
    • 2011-06-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多