gpt4 book ai didi

asp.net - System.Diagnostics.Trace 在 ApplicationPoolIdentity 下的 Web 应用程序中不起作用

转载 作者:行者123 更新时间:2023-12-02 14:15:36 24 4
gpt4 key购买 nike

我有一个 Web 应用程序(滥用)使用 System.Diagnostics Tracing。和往常一样,一切都很顺利,直到我们本周开始制作,我们的听众都没有受到影响。

经过一番研究,这显然是用户帐户权限问题。从 ApplicationPoolIdentity 更改为 LocalSystem 似乎可以解决问题。但是,在我们的生产环境中,将运行的用户更改为 LocalSystem 是不行的。我怀疑这与the security permission有关需要运行非托管代码。

还有其他方法可以使跟踪在 ApplicationPoolIdentity 下工作吗?或者(正如我们的系统管理员建议的那样)我们应该创建一个自定义帐户来运行该应用程序池吗?

最佳答案

您有什么证据表明您的 TraceListener 没有受到攻击?在我看来,他们更有可能受到攻击,但他们没有访问某些所需资源(例如文件)的权限。在这种情况下,解决方案可能很简单,只需授予您对相应磁盘文件夹的 ApplicationPoolIdentity 权限即可。

我建议您发布您正在使用的监听器的更多详细信息(例如 web.config 文件的 <system.diagnostics> 部分,以及您看到的确切错误。

I suspect it has something to do with the security permission needed to run unmanaged code.

您认为哪些跟踪监听器使用非托管代码?

We tried EventLogTraceListener and even TextWriterListener on a folder that the user should have permissions.

您需要explicitly give permissions to the application pool identity ,默认情况下没有权限。

将 TextWriterListener 使用的文件夹的读/写权限授予“IIS AppPool\DefaultAppPool”或您正在使用的任何应用程序池名称。

对于事件日志,非管理员通常没有创建事件源的权限,因此您应该在应用程序安装期间手动创建事件源,或者也可以使用现有的事件源(例如“.NET 运行时”)。

I think that it's not a specific listener that needs unmanaged code permissions, but the whole tracing functionality.

你在这里咆哮错误的树。运行非托管代码的权限是 Code Access Security权限,不会受到应用程序运行的帐户的影响。而且你说在LocalSystem帐户下工作正常。

关于asp.net - System.Diagnostics.Trace 在 ApplicationPoolIdentity 下的 Web 应用程序中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18793727/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com