IIS不使用用户环境变量 [英] IIS doesn't use user environment variables

查看:145
本文介绍了IIS不使用用户环境变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将.NET Core应用程序两次部署到同一台服务器,一次用于QA,一次用于生产。目前,我每个人都使用不同的本地用户来运行IIS应用程序池,并相应地将ASPNETCORE_ENVIRONMENT变量设置为qa和production。

I'm deploying a .NET Core application twice to the same server, once for QA, and once for Production. Currently I have each one of them using a different local user to run the IIS App Pool and have set the ASPNETCORE_ENVIRONMENT variables to "qa" and "production" accordingly.

这个看起来不起作用,两个站点都运行生产配置,我理解这是默认设置。

This doesn't appear to work, both sites run the production configuration which I understand is the default.

到目前为止我看过的事情:

Things I've looked at so far:


  1. 我可以作为每个用户登录,并且变量正确设置为

  2. 没有系统级别的env var设置,但是如果有用户级别的vars应该覆盖它。

  3. 我可以看到进程在任务管理器中作为正确的用户运行。

  4. 我在设置env vars后重启了整个系统

  1. I can log in as each of the users, and the variables are set correctly.
  2. There is no system level env var set, though the user level vars are supposed to override it if there was.
  3. I can see the processes running as the correct users in the task manager.
  4. I have restarted the entire system after setting the env vars

似乎.NET忽略了环境变量。

It just appears that .NET is ignoring the environment variable.

是否还有其他人设法使用.NET核心部署来获得用户级别的env变量?

Has anyone else managed to get user level env vars working with a .NET core deployment?

附加信息:我可以在系统级别设置ASPNETCORE_ENVIRONMENT,两个站点都会选择它并随之运行。没有系统变量的做法根本不起作用。

Additional Info: I can set ASPNETCORE_ENVIRONMENT at the system level, and both sites pick it up and run with it. Doing it without a system variable simply doesn't work.

推荐答案

如果你想使用特定于用户的环境变量,那么应用程序池设置LoadUserProfile应该设置为true(默认为false),

If you want to use user specific environment variables, then the application pool setting LoadUserProfile should be set to true (false is the default),

当我设置IIS池的LoadUserProfile时会发生什么?

这篇关于IIS不使用用户环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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