在Azure Web App上使用ASP.Net Core在容器上配置AppSettings:冒号冒号? [英] Configuring AppSettings with ASP.Net Core on Azure Web App for Containers: Whither Colons?
问题描述
考虑此appsettings.json
:
{
"Parent": {
"ChildOne": "C1 from secrets.json",
"ChildTwo": "C2 from secrets.json"
}
}
根据Microsoft( https://blogs.msdn.microsoft.com/waws/2018/06/12/asp-net-core-settings-for-azure-app-service/)(如果有应用程序)使用此配置被部署到Azure中的AppService,可以通过在Azure中以样式Parent:ChildOne
/Parent:ChildTwo
创建应用程序设置来覆盖该配置.需要明确的是:使用冒号来定位特定的配置.
According to Microsoft (https://blogs.msdn.microsoft.com/waws/2018/06/12/asp-net-core-settings-for-azure-app-service/), if an app using this config was deployed to an AppService in Azure, the config could be overwritten by creating Application settings in Azure in the style Parent:ChildOne
/ Parent:ChildTwo
. To be clear: using colons to target a specific piece of config.
这对于标准的AppService可以正常工作:
This works just fine with a standard AppService:
但是,如果您使用Web App for Containers/即将Docker映像部署到Linux上的Azure App Service(
However, if you're using Web App for Containers / i.e. a Docker image deployed to an Azure App Service on Linux (https://docs.microsoft.com/en-us/azure/app-service/containers/app-service-linux-intro) you cannot use colons:
为什么?
将鼠标悬停在错误上时,您会看到以下消息:This field can only contain letters, numbers (0-9), periods ("."), and underscores ("_")
.使用.
无效.
When you hover over the error you see this message: This field can only contain letters, numbers (0-9), periods ("."), and underscores ("_")
. Using .
does not work alas.
如何在Azure中配置说Parent:ChildOne
? Parent.ChildOne
不起作用.有人可以建议吗?我找不到关于此的任何文档....
How do you configure say Parent:ChildOne
in Azure? Parent.ChildOne
does not work. Can anyone advise? I can't find any docs on this....
推荐答案
经过比我想承认的更多实验,
After more experimentation than I'd like to admit I think I have the answer.
在App Service上使用:
的地方,请在带有容器的App Service上使用__
(双下划线).
Where you use :
on an App Service, use a __
(double underscore) on an App Service with containers.
所以Parent__ChildOne
而不是Parent:ChildOne
.
这篇关于在Azure Web App上使用ASP.Net Core在容器上配置AppSettings:冒号冒号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!