如何在同一台计算机上配置多个ASPNETCORE_ENVIRONMENT? [英] How to configure multiple ASPNETCORE_ENVIRONMENT on same machine?
问题描述
我有ASP.NET核心Web应用程序。我已经在Web服务器上配置了Web应用程序,并将 ASPNETCORE_ENVIRONMENT
变量设置为 Development
。我在机器级别设置此变量,如下图所示。
现在,我要在同一台计算机上将同一Web应用程序的另一个实例配置为 Staging
环境。
I have ASP.NET core web application. I have configured the web application on our web server and set the ASPNETCORE_ENVIRONMENT
variable to Development
. I set this variable at machine level like shown in the picture below.
Now on the same machine i want to configured one more instance of same web application as Staging
environment.
在应用程序级别而不是计算机级别设置 ASPNETCORE_ENVIRONMENT
的我这里有什么选择?这样我就可以在同一台机器上托管同一应用程序的多个实例?
What are my options here to set ASPNETCORE_ENVIRONMENT
at application level instead of machine level? so i can host multiple instances of the same application on the same machine?
推荐答案
您有几个选择。 / p>
You have a couple of options.
-
以不同的用户身份运行每个应用程序,并在该用户配置文件中设置环境变量。这给您增加了不错的安全性奖励。您必须设置应用程序池以加载用户配置文件。
Run each app as a different user, and set the environment variable within that user profile. This gives you a nice added security bonus. You'll have to set the app pool to load the user profile.
使用IIS配置
- 启动IIS管理器
- 选择配置编辑器下拉
组合框并选择system.webServer / aspNetCore - 从
组合框中拉出并选择Applicationhost.config - 单击
environmentVariables元素,然后单击隐藏在
中的...按钮第二列,在右侧。 - 设置环境变量。
- 退出环境变量屏幕,然后单击应用。
- 重新启动应用程序池/应用程序。
- Start IIS manager
- Choose configuration editor Pull down the section combobox and choose system.webServer/aspNetCore
- Pull down the from combobox and choose Applicationhost.config
- Click on the environmentVariables element and click on the ... button hiding in the second column, at the right.
- Set your environment variables.
- Exit out of the environment variables screen and then click Apply.
- Restart the app pool/app.
这篇关于如何在同一台计算机上配置多个ASPNETCORE_ENVIRONMENT?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!