【问题标题】:Failed to decrypt web.config file - Encryption using 'RsaProtectedConfigurationProvide'无法解密 web.config 文件 - 使用“RsaProtectedConfigurationProvide”加密
【发布时间】:2015-02-25 13:34:20
【问题描述】:

我想在my web.config 文件中加密connection string。我关注了this article,得到了加密的连接字符串。我遵循以下步骤

  1. 以管理员身份运行命令提示符
  2. 已到达aspnet_regiis
  3. Emcryted 使用命令ASPNET_REGIIS -pef "connectionStrings" "D:\ProjPath"

它被加密了,但是当我运行我的应用程序时,我收到了这个错误

Failed to decrypt using provider 'RsaProtectedConfigurationProvider'. Error message from the provider: The RSA key container could not be opened.

在线<EncryptedData Type="http://www.w3.org/2001/04/xmlenc#Element"

我在本地机器上收到此错误意味着不可能出现机器密钥问题,当我使用ASPNET_REGIIS -pdf "connectionStrings" "D:\ProjPath" 解密它时,我得到了正确的连接字符串。

另外有没有办法加密DataConfig.Config文件中的连接字符串Sitefinity

【问题讨论】:

    标签: c# asp.net encryption connection-string sitefinity


    【解决方案1】:

    这样试试

    1. 进入 IIS 并选择问题所在的站点
    2. 首页-->认证双击
    3. 禁用 ASP.NET 模拟

    这应该可以解决您的问题

    您可以在 system.web 下的 web 配置中禁用它

    <identity impersonate="false"/> 
    

    更新

    我认为这可能是密钥导出的问题

    试试这个命令 (documentation)

    aspnet_regiis -pc "NetFrameworkConfigurationKey" -exp
    aspnet_regiis -pa "NetFrameworkConfigurationKey" "ASPNET"
    aspnet_regiis -pa "NetFrameworkConfigurationKey" "NETWORK SERVICE"
    aspnet_regiis -pa "NetFrameworkConfigurationKey" "NT AUTHORITY\NETWORK SERVICE"
    

    【讨论】:

    • 我在本地机器上运行这个,这里有IIS的参与吗?
    • 第一个命令成功执行,但第二个命令在控制台上抛出错误The trust relationship between this workstation and primary domain failed &lt;Exception from HRESULT:0x800706FD&gt;
    • ASPNET, NETWORK SERVICE, NT AUTHORITY\NETWORK SERVICE 应该是有效的用户名(或组),用登录到机器的用户名替换它们(一个命令就足够了)并让我知道
    • 我将“ASPNET”替换为“SGTECH\devuser16”,它是用户并执行了。替换“NETWORK SERVICE”和“NT AUTHORITY\NETWORK SERVICE”后,所有命令现在看起来都一样我做对了吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-10-26
    • 1970-01-01
    • 2016-09-10
    • 1970-01-01
    • 1970-01-01
    • 2016-12-30
    • 1970-01-01
    相关资源
    最近更新 更多