【问题标题】:Can I encrypt web.config with a custom protection provider who's assembly is not in the GAC?我可以使用程序集不在 GAC 中的自定义保护提供程序加密 web.config 吗?
【发布时间】:2011-02-21 18:41:24
【问题描述】:

我为我的 web.config 编写了一个自定义的受保护配置提供程序。

当我尝试用它加密我的 web.config 时,我从 aspnet_iisreg 收到以下错误

aspnet_regiis.exe -pef appSettings 。 -prov CustomProvider(在我的 MSBuild 中运行)

无法加载文件或程序集“MyCustomProviderNamespace”或其依赖项之一。系统找不到指定的文件。

检查 Fusion 日志后,我确认它正在检查 GAC 和“C:/WINNT/Microsoft.NET/Framework/v2.0.50727/”(aspnet_iisreg 的位置)。但它找不到提供者。

我不想将我的组件移动到 GAC 中,我想将自定义程序集留在我的 ApplicationBase 中以复制到各种服务器,而不必从 GAC 中拉/推。

这是我在 web.config 中的提供程序配置。

<configProtectedData>
  <providers>
    <add name="CustomProvider"
         type="MyCustomProviderNamespace.MyCustomProviderClass,
         MyCustomProviderNamespace" />
  </providers>
</configProtectedData>

我希望 aspnet_iisreg 检查我的 ApplicationBase Bin 文件夹中的这个程序集。有人有什么想法吗?

【问题讨论】:

    标签: .net asp.net security encryption web-config


    【解决方案1】:

    有点脏,我最终做的是将进行加密的 DLL 添加到构建机器的 GAC 中。这对配置进行了加密。

    在部署解决方案时,我将 Dll 复制到 ApplicationBase 中,应用程序能够成功解密。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-12-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多