ASP.NET Core中正确设置环境变量

一般设置都是放在appsettings.json,为了安全,特地把一些敏感信息如密码移到环境变量中去,那么如何设置带有子元素的变量呢比如ConnectStrings:

Windows下用冒号“:”分级比如:

1
ASPNETCORE_ConnectionStrings:BlogDb=conn_str

Linux/Mac下用双下划线“__”分级比如:

1
ASPNETCORE_ConnectionStrings__BlogDb=conn_str
作者

Carry

发布于

2021-11-05

更新于

2026-05-23

许可协议

You need to set install_url to use ShareThis. Please set it in _config.yml.
You forgot to set the business or currency_code for Paypal. Please set it in _config.yml.

评论

You forgot to set the shortname for Disqus. Please set it in _config.yml.
You need to set client_id and slot_id to show this AD unit. Please set it in _config.yml.