Ms0*_*s01 6 asp.net azure azure-web-sites
我有一个ASP.NET核心应用程序正在设置Github自动部署它.但由于它是一个开放的回购,我显然不想上传我正确的配置文件.
我想做的是在github自动部署后替换appsettings.json中的一些字符串.
"AppSettings": {
"Token": "my super duper secret token"
}
Run Code Online (Sandbox Code Playgroud)
如何my super duper secret token在Azure上部署github后更改为我的真实令牌?
Tom*_*SFT 16
据我所知,我们可以在Azure端口的App Settings中配置令牌.我对此进行了测试,它运行成功,以下是我的详细步骤.

services.Configure<AppSettings>(Configuration.GetSection("AppSettings"))在Startup.cs文件中的函数ConfigureService函数中添加代码(对于.net Core 1.0).注意:模型绑定的语法已从RC1更改为RC2.使用
services.Configure<AppSettings>(Configuration.GetSection("AppSettings")),不再可用为了将设置类绑定到您的配置,您需要在Startup.cs的ConfigureServices方法中进行配置:services.Configure<AppSettings>(options => Configuration.GetSection("AppSettings").Bind(options));
| 归档时间: |
|
| 查看次数: |
4606 次 |
| 最近记录: |