ASP.NET Core中的环境变量之间有什么区别? [英] What are the differences between the environment variables in ASP.NET Core?

查看:165
本文介绍了ASP.NET Core中的环境变量之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

浏览(ASP).NET Core的文档时,我遇到了多个环境变量名称,它们似乎实际上具有相同或至少相似的作用.

Going through documentation for (ASP).NET Core, I come across multiple environment variable names that seem to do virtually the same, or at least similar, things.

但是,我很难找到关于它们之间到底有什么不同的任何详细信息.

However, I'm having a hard time finding any detailed information on what exactly differs between:

  • 托管:环境
  • ASPNETCORE_ENVIRONMENT
  • ASPNET_ENV

这是特定于服务器的(例如IIS vs Kestrel),还是与其他服务器有关?

Is this server-specific (IIS vs Kestrel, for example), or is it relating to something else?

推荐答案

ASPNET_ENV 是旧版,已被删除,请改用"ASPNETCORE_ENVIRONMENT".它是在此问题和pr中声明的:

ASPNET_ENV is legacy and has been removed, use 'ASPNETCORE_ENVIRONMENT' instead. It was announced in this issue and pr: Rename environment variables to ASPNETCORE_.

Hosting:Environment 在RC1中用作ASPNET_ENV的替代品,现在也已成为传统.有关更多详细信息,请参见此 ASPNET_ENV变量应在文档中更改为Hosting:Environment 问题.

ASPNETCORE_ENVIRONMENT 用于描述应用程序当前正在运行的环境in.可以将变量设置为任何您喜欢的值,但习惯上使用三个值: Development Staging Production .

ASPNETCORE_ENVIRONMENT is used to describe the environment the application is currently running in. This variable can be set to any value you like, but three values are used by convention: Development, Staging, and Production.

这篇关于ASP.NET Core中的环境变量之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆