DataProtectionConfigurationProvider 无法在我的 Azure 应用服务上运行

DataProtectionConfigurationProvider not working on my Azure app service

我正在尝试加密项目 App.config 文件中的连接字符串数据。 我发现 this topic,解决方案基本上是,我提供我的连接字符串 -> 它对其进行加密 -> 我将给定的加密字符串放入我的 App.config 和 bam。它有效(正常)。

这是加密字符串的样子:

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

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

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

提前致谢!

config file encryption method for Azure web site and web job

Because of the particularity of the Azure Web AppService platform, so the C# config original encryption method of DataProtectionConfigurationProvider and RSAProtectedConfigurationProvider in the Azure platform is not available.

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