如何在同一台计算机上配置多个ASPNETCORE_ENVIRONMENT? [英] How to configure multiple ASPNETCORE_ENVIRONMENT on same machine?

查看:111
本文介绍了如何在同一台计算机上配置多个ASPNETCORE_ENVIRONMENT?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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


  1. 以不同的用户身份运行每个应用程序,并在该用户配置文件中设置环境变量。这给您增加了不错的安全性奖励。您必须设置应用程序池以加载用户配置文件。

  1. 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配置


  1. 启动IIS管理器

  2. 选择配置编辑器下拉
    组合框并选择system.webServer / aspNetCore


  3. 组合框中拉出并选择Applicationhost.config

  4. 单击
    environmentVariables元素,然后单击隐藏在
    中的...按钮第二列,在右侧。

  5. 设置环境变量。

  6. 退出环境变量屏幕,然后单击应用。

  7. 重新启动应用程序池/应用程序。

  1. Start IIS manager
  2. Choose configuration editor Pull down the section combobox and choose system.webServer/aspNetCore
  3. Pull down the from combobox and choose Applicationhost.config
  4. Click on the environmentVariables element and click on the ... button hiding in the second column, at the right.
  5. Set your environment variables.
  6. Exit out of the environment variables screen and then click Apply.
  7. Restart the app pool/app.


这篇关于如何在同一台计算机上配置多个ASPNETCORE_ENVIRONMENT?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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