[英]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.