为什么我需要发布我的项目。在Azure上设置ASPNETCORE_ENVIRONMENT变量时的json

时间:2022-10-29 23:30:01

I start a new website, with to default VS2015 template for ASP.NET Core. Just for testing purpose I published It 'as is' on Azure.

我创建了一个新的网站,默认为ASP的VS2015模板。净的核心。为了测试目的,我在Azure上发布了“as is”。

I set my ASPNETCORE_ENVIRONMENT to Development on my Azure Website (Paas).

我将ASPNETCORE_ENVIRONMENT设置为在我的Azure网站(Paas)上进行开发。

I set the environment variable directly in the Azure Management Portal for my Website as: 为什么我需要发布我的项目。在Azure上设置ASPNETCORE_ENVIRONMENT变量时的json

我在Azure管理门户网站上直接设置了环境变量为:

But when I do that I get : 为什么我需要发布我的项目。在Azure上设置ASPNETCORE_ENVIRONMENT变量时的json

但当我这样做时,我得到:

So By default ASPNET Core on Azure is set to "Production" Environment. When I leave it that way I don't need my "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.

因此默认情况下,Azure上的ASPNET核心被设置为“生产”环境。这样的话,我就不需要我的“project.json”了。但是当我添加ASPNETCORE_ENVIRONMENT时,我需要发布项目。使用VS2015内置工具和/或使用链接的git存储库不会自动发布json文件witch。

Is there a way to simplify this behavior or do I missed something?

有没有一种方法可以简化这种行为,或者我遗漏了什么?

1 个解决方案

#1


1  

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. 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.

我想线索就在你的堆栈跟踪中。它试图调查项目。json用于确定用户机密文件的位置,该文件只用于本地开发,如果使用默认模板,则在“开发”环境中启用。对于Azure应用程序服务中的开发/测试环境,我将环境设置为“Staging”,除了提取用户机密之外,我通常将其配置为与“开发”相同的配置。

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

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

#1


1  

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. 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.

我想线索就在你的堆栈跟踪中。它试图调查项目。json用于确定用户机密文件的位置,该文件只用于本地开发,如果使用默认模板,则在“开发”环境中启用。对于Azure应用程序服务中的开发/测试环境,我将环境设置为“Staging”,除了提取用户机密之外,我通常将其配置为与“开发”相同的配置。

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

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