【问题标题】:DataProtectionConfigurationProvider not working on my Azure app serviceDataProtectionConfigurationProvider 在我的 Azure 应用服务上不起作用
【发布时间】:2021-05-18 19:32:55
【问题描述】:

我正在尝试在我的项目的 App.config 文件中加密我的连接字符串数据。 我找到了this topic,解决方案基本上是,我给我的连接字符串->它加密它->我把给定的加密字符串放入我的App.config和bam中。它可以正常工作。

这是加密字符串的样子:

<connectionStrings configProtectionProvider="DataProtectionConfigurationProvider">
    <EncryptedData> 
        <CipherData> 
            <CipherValue>AQAAANCMnd...</CipherValue> 
        </CipherData> 
    </EncryptedData> 
</connectionStrings>

该解决方案适用于我的本地解决方案,我可以毫无问题地访问我的数据库。 但是,当我将项目上传到我的 Azure 应用服务时,无法访问数据库。我确定这是因为加密的数据,但我不知道为什么(数据库连接在没有加密的情况下工作)。

所以,如果你有想法,你就是我唯一的希望。我想保持加密简单,我找到了很多其他解决方案,但我发现它们非常复杂。

提前致谢!

【问题讨论】:

  • 如果我的解决方案对您有启发或帮助,请将我的答案标记为accepted,谢谢~

标签: c# azure encryption azure-web-app-service app-config


【解决方案1】:

config file encryption method for Azure web site and web job

由于Azure Web AppService平台的特殊性,所以无法使用Azure平台中DataProtectionConfigurationProvider和RSAProtectedConfigurationProvider的C#config原始加密方式。

仔细阅读文章可以知道,DataProtectionConfigurationProvider不能以Azure web app的传统方式生效。可以参考文章中的解决方案进行处理。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-12-27
    • 2020-04-19
    • 1970-01-01
    • 2020-12-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多