如何将 ASP.NET Core UserSecrets 部署到生产环境

How to deploy ASP.NET Core UserSecrets to production(如何将 ASP.NET Core UserSecrets 部署到生产环境)
本文介绍了如何将 ASP.NET Core UserSecrets 部署到生产环境的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遵循在开发过程中安全存储应用机密在开发期间指导 asp.net 文档,但它没有描述在发布到另一台机器进行 QA、生产等时如何使用它.我认为它会在发布期间将它们插入 appsettings.json 但确实如此不是.我最终不得不将我的 SendGrid 密钥和其他敏感信息直接放入 appsettings.json 中,这确实违背了应用机密的目的.

使用应用程序机密是最好的方法,还是有其他方法可以在我的配置中存储 API 密钥和 SQL 用户/密码?

解决方案

不要在生产环境中使用应用机密.曾经.正如文章所说,在开发过程中.

如何在生产环境中发布机密取决于您的生产环境.Linux、Windows 和 Azure 都支持环境变量——这就是你的秘密应该去的地方,使用你的托管服务提供商给你的任何 UI.

应用程序设置文档对此进行了更详细的说明p>

I followed the Safe storage of app secrets during development guide over on the asp.net docs during development but it does not describe how to use it when publishing to another machine for QA, Production, etc. What I figured it would do was insert them into the appsettings.json during publish but it does not. I ended up having to place my SendGrid keys and other sensitive information directly into the appsettings.json which really defeats the purpose of the app secrets.

Is using app secrets the best way or is there another way to store API keys and SQL user/passwords in my configs?

解决方案

Don't use app secrets in production. Ever. As the article says DURING DEVELOPMENT.

How you publish secrets in production is up to your production environment. Linux, Windows and Azure all support environment variables - that's where your secrets should go, using whatever UI your hosting provider gives you.

The app settings documentation goes into this in greater detail

这篇关于如何将 ASP.NET Core UserSecrets 部署到生产环境的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

DispatcherQueue null when trying to update Ui property in ViewModel(尝试更新ViewModel中的Ui属性时DispatcherQueue为空)
Drawing over all windows on multiple monitors(在多个监视器上绘制所有窗口)
Programmatically show the desktop(以编程方式显示桌面)
c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
LINQ many-to-many relationship, how to write a correct WHERE clause?(LINQ多对多关系,如何写一个正确的WHERE子句?)