简体   繁体   English

为什么在Azure上设置ASPNETCORE_ENVIRONMENT变量时需要发布我的project.json

[英]Why do I need to publish my project.json when setting ASPNETCORE_ENVIRONMENT variable on Azure

I start a new website, with to default VS2015 template for ASP.NET Core. 我启动了一个新的网站,默认为ASP.NET Core的VS2015模板。 Just for testing purpose I published It 'as is' on Azure. 出于测试目的,我在Azure上发布了“原样”。

I set my ASPNETCORE_ENVIRONMENT to Development on my Azure Website (Paas). 我在我的Azure网站(Paas)上将我的ASPNETCORE_ENVIRONMENT设置为Development。

I set the environment variable directly in the Azure Management Portal for my Website as: 我直接在我的网站的Azure管理门户中设置环境变量: 在此输入图像描述

But when I do that I get : 但当我这样做时,我得到: 在此输入图像描述

So By default ASPNET Core on Azure is set to "Production" Environment. 因此,默认情况下,Azure上的ASPNET Core设置为“生产”环境。 When I leave it that way I don't need my "project.json". 当我这样离开时,我不需要我的“project.json”。 But When i Add the ASPNETCORE_ENVIRONMENT I need to publish the project.json file witch is not publish automatically using VS2015 Built-In tools and/or using a linked git repository. 但是当我添加ASPNETCORE_ENVIRONMENT时,我需要发布project.json文件,而不是使用VS2015内置工具和/或使用链接的git存储库自动发布。

Is there a way to simplify this behavior or do I missed something? 有没有办法简化这种行为或我错过了什么?

I think the clue is in your stack trace. 我认为线索在你的堆栈跟踪中。 It's trying to look into project.json to figure out where your user secrets file is, which is only supposed to be used for local development and is enabled in the "Development" environment if using the default template. 它试图查看project.json以确定用户保密文件的位置,该文​​件仅用于本地开发,如果使用默认模板,则在“开发”环境中启用。 For my development/testing environments in Azure App Services, I set the Environment to "Staging", which I typically have configured the same as "Development" except for pulling user secrets. 对于我在Azure App Services中的开发/测试环境,我将环境设置为“暂存”,我通常将其配置为与“开发”相同,除了用于提取用户机密。

https://docs.microsoft.com/en-us/aspnet/core/security/app-secrets https://docs.microsoft.com/en-us/aspnet/core/security/app-secrets

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用 ASPNETCORE_ENVIRONMENT 覆盖 Azure 上的 appsettings.json - Override appsettings.json on Azure using ASPNETCORE_ENVIRONMENT 如何在运行时设置 ASPNETCORE_ENVIRONMENT 变量 - How to set ASPNETCORE_ENVIRONMENT variable at runtime 是否可以重命名 ASPNETCORE_ENVIRONMENT 变量? - Is it possible to rename ASPNETCORE_ENVIRONMENT variable? AZURE_FUNCTIONS_ENVIRONMENT 与 ASPNETCORE_ENVIRONMENT - AZURE_FUNCTIONS_ENVIRONMENT vs ASPNETCORE_ENVIRONMENT 为什么 Webservice 不使用来自 web.config 的变量 AS.NETCORE_ENVIRONMENT - Why Webservice doesn't use variable ASPNETCORE_ENVIRONMENT from web.config ".NET Core 控制台应用程序和 aspnetcore_environment 变量" - .NET Core console app and aspnetcore_environment variable 为什么 ChartJs.Blazor 有错误(更改 ASPNETCORE_ENVIRONMENT) - Why is there an error in ChartJs.Blazor (change in ASPNETCORE_ENVIRONMENT) 如何在ASP.NET 5 MVC 6的project.json文件中找到要添加的库以及需要指定的版本 - How do I find out what library to add and what version I need to specify in my project.json file for ASP.NET 5 MVC 6 不使用project.json时在vscode中的project.json警告 - project.json warning in vscode when not using project.json 在T4模板中获取ASPNETCORE_ENVIRONMENT? - Get ASPNETCORE_ENVIRONMENT in T4 Template?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM