写入事件日志时出现 System.Security.SecurityException

编程入门 行业动态 更新时间:2024-10-25 02:20:56
本文介绍了写入事件日志时出现 System.Security.SecurityException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试将 ASP.NET 应用程序从 Server 2003(和 IIS6)移植到 Server 2008 (IIS7).

I’m working on trying to port an ASP.NET app from Server 2003 (and IIS6) to Server 2008 (IIS7).

当我尝试访问浏览器上的页面时,我得到了这个:

When I try and visit the page on the browser I get this:

/"应用程序中的服务器错误.

Server Error in ‘/’ Application.

安全异常

描述:应用程序试图执行安全策略不允许的操作.要授予此应用所需的权限,请联系您的系统管理员或在配置文件中更改应用的信任级别.

Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application’s trust level in the configuration file.

异常详细信息:System.Security.SecurityException:未找到源,但无法搜索部分或全部事件日志.无法访问的日志:安全

Exception Details: System.Security.SecurityException: The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security

源错误:

在执行当前 Web 请求期间生成了未处理的异常.可以使用下面的异常堆栈跟踪来识别有关异常来源和位置的信息.

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and the location of the exception can be identified using the exception stack trace below.

堆栈跟踪:

[SecurityException:未找到源,但无法搜索部分或全部事件日志.无法访问的日志:安全.]

[SecurityException: The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security.]

System.Diagnostics.EventLog.FindSourceRegistration(String source, String machineName, Boolean readOnly) +562System.Diagnostics.EventLog.SourceExists(String source, String machineName) +251

System.Diagnostics.EventLog.FindSourceRegistration(String source, String machineName, Boolean readOnly) +562 System.Diagnostics.EventLog.SourceExists(String source, String machineName) +251

[剪辑]

这些是我尝试解决的方法:

These are the things I’ve done to try and solve it:

  • 授予所有人"对密钥 HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesEventLogSecurity 的完全访问权限.这奏效了.但自然我不能在生产中做到这一点.所以我在运行应用几分钟后删除了所有人"权限,错误再次出现.

  • Give "Everyone" full access permission to the key HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesEventLogSecurity. This worked. But naturally I can’t do this in production. So I deleted the "Everyone" permission after running the app for a few minutes and the error re-appeared.

    我在安装过程中使用提升的权限在应用程序日志和安全日志中创建了源(并且我通过 regedit 验证了它存在),但错误仍然存​​在.

    I created the source in the Application log and the Security log (and I verified it exists via regedit) during installation with elevated permissions but the error remained.

    我在 web.config 文件(并使用 appcmd.exe)中为应用程序提供了完全信任级别,但无济于事.

    I gave the app a full trust level in the web.config file (and using appcmd.exe) but to no avail.

    有没有人知道这里可以做什么?

    Does anyone have an insight as to what could be done here?

    PS:这是这个问题的后续行动.我按照给定的答案进行操作,但无济于事(请参阅上面的 #2).

    PS: This is a follow up to this question. I followed the given answers but to no avail (see #2 above).

    推荐答案

    解决方案是授予网络服务"帐户对 EventLog/Security 密钥的读取权限.

    The solution was to give the "Network Service" account read permission on the EventLog/Security key.

  • 更多推荐

    写入事件日志时出现 System.Security.SecurityException

    本文发布于:2023-11-11 07:57:32,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1577819.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:事件   日志   System   Security   SecurityException

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!