写入事件日志时的System.Security.SecurityException异常 [英] System.Security.SecurityException when writing to Event Log

查看:359
本文介绍了写入事件日志时的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)+562
System.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

[snip]

这些是我试图解决的事情:

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


  1. 给每个人完全访问权限 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Security 。这样工作。但是,我自然不会在生产中做到这一点。所以我在运行应用程序几分钟之后删除了Everyone权限,并重新出现错误。

  1. Give "Everyone" full access permission to the key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Security. 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.

我给该应用程序一个完整的信任级别 c /> c $ c>文件(并使用 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异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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