Failed to decrypt using provider 'RsaProtectedConfigurationProvider'?

前端 未结 2 1925
眼角桃花
眼角桃花 2020-12-31 21:19

In my windows application i am trying to encrypt connection string section of app.config file, connection string part of my app.config file is



        
相关标签:
2条回答
  • 2020-12-31 22:00

    The app.config file will have been encrypted using a certificate on your local machine. This certificate will not be present on the other machine. You will therefore not be able to decrypt the app.config file.

    For this to work, you need to export the encryption key on your machine, then import it on the other machine. The following article demonstrates how to do that: Walkthrough: Creating and Exporting an RSA Key Container

    0 讨论(0)
  • 2020-12-31 22:06

    Using this command aspnet_regiis -pa

    Open cmd Console -execute as Administrator-

    C:\Windows\system32>aspnet_regiis -pa "NetFrameworkConfigurationKey" "myDomain\myUser"
    Microsoft (R) ASP.NET RegIIS versión 4.0.30319.33440
    Utilidad de administración que instala y desinstala ASP.NET en el equipo local.
    Copyright (C) Microsoft Corporation. Todos los derechos reservados.
    Agregando ACL para el acceso al contenedor de claves RSA...
    Con éxito
    

    More references:

    Ɖiamond ǤeezeƦ answer

    The RsaProtectedConfigurationProvider sometimes fails when encrypting an application configuration file

    ASP.NET Encryption - aspnet_regiis - Farm

    Encrypting and Decrypting Web.config Sections in .NET 4.0

    0 讨论(0)
提交回复
热议问题