我有一个将消息写入事件日志的应用程序。我传递给EventLog.WriteEntry的源不存在,因此Framework尝试通过将源添加到注册表来创建源。如果用户是管理员,它可以正常工作我得到以下用户不是管理员:

<!>“; System.Security.SecurityException:不允许请求的注册表访问。<!> quot;信息。

我该如何解决?

<强>更新

我已在注册表中手动创建具有管理员帐户的注册表。现在,我有错误:System.Security.SecurityException:不允许请求的注册表访问。

我不明白,因为我在群组管理员中创建了一个用户...我还需要做些什么?

有帮助吗?

解决方案

为了您的更新,我找到了可能对您有所帮助的内容:

Run regedt32
Navigate to the following key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Security
Right click on this entry and select Permissions
Add the ASPNET user
Give it Read permission

2. Change settings in machine.config file

Run Explorer
Navigate to WINDOWS or WINNT folder
Open Microsoft.NET folder
Open Framework folder
Open v1.1.4322 folder (folder name may be different, depending on what dotnet version is installed)
Open CONFIG folder
Open machine.config file using notepad (make a backup of this file first)
Locate processmodel tag (approx. at line 441)
Locate userName="machine" (approx. at line 452)
Change it to userName="SYSTEM"
Save and close the file
Close Explorer

3. Restart IIS

Run IISReset

来源在这里

其他提示

<!>“非编程方式<!>”;是授予用户您的Web应用程序/ Web服务用户可以访问注册表(事件日志写入事件日志)。

这些都不适合我。诀窍是从<!>“ApplicationPoolIdentity <!>”改变应用程序池标识。 to <!> quot; LocalSystem <!> quot;。然后将LocalSystem Windows帐户放入Administrators组。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top