我可以在 IIS Express 中禁用 loaduserprofile 吗?

Can I disable loaduserprofile in IIS Express?

在我们的生产环境中,Web 应用程序托管在 IIS 上。在 loaduserprofile=false 的通用配置文件下池应用程序 运行。 (我猜)这就是为什么我在尝试访问 System.Diagnostics.EventLog.

时被拒绝访问的原因

当我在 VS 2017 中调试解决方案时,它托管在 IIS Express 中,并且在访问 System.Diagnostics.EventLog 时不会引发任何错误。

我可以在 IIS Express 中禁用 loaduserprofile 以使其表现得像完整的 IIS 吗?
它甚至有意义吗?
还是 IIS Express 总是 运行 使用在 VS 中启动它的配置文件?

Visual studio 运行 在您的默认帐户下,该帐户有权访问 iis 应用程序或站点的所有内容 运行 在使用 iis 用户(如 iusr 或 [=)的应用程序池身份下31=] 无法使用所有的东西。这就是为什么您收到拒绝访问错误消息的原因。如果您想更改应用程序池标识,您可以 select 适当的应用程序池并使用高级设置进行设置。本地系统和网络服务在应用程序池标识中具有足够的访问权限

.

如果要将加载用户配置文件设置为 false,则可以将 applicationhost.config 文件直接修改为 add/manage 应用程序池。要设置启用加载用户配置文件,您需要修改与您的应用程序池相关的行,并在 XML 元素中添加以下行。:

<processModel loadUserProfile="true" />

您可以参考下面link了解更多详情:

What exactly happens when I set LoadUserProfile of IIS pool?

loadUserProfile and IIS7 - understanding temporary directory failures

Access denied when reading system event log entries on ASP.NET web application hosted on IIS 8