Linux中的ASP.NET Core Environment变量冒号

fia*_*iat 19 linux asp.net-core

在ASP.NET Core中,通过环境变量的嵌套配置通常通过冒号语法完成:

MySettings:SomeSetting=MyNewValue

你是如何在Linux中做到这一点的?该export命令将拒绝结肠?例如:

export MySettings:SomeSetting=MyNewValue

错误

bash: export: `MySettings:SomeSetting=MyNewValue': not a valid identifier
Run Code Online (Sandbox Code Playgroud)

fia*_*iat 49

仔细阅读文档:

如果:无法在系统中的环境变量中使用,请替换:__(双下划线).

即:

export MySettings__SomeSetting=MyNewValue
Run Code Online (Sandbox Code Playgroud)

  • https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration?tabs=basicconfiguration#simple-configuration实际上是正确的来源.自从你把它链接起来后可能会发生变化. (2认同)