WebService调用创建应用程序事件日志权限问题

问题描述

在维护老项目时,调用WebService接口返回500,响应内容如下:

{
    "Message": "The event source ExceptionManagerPublishedException does not exist and cannot be created with the current permissions.",
    "StackTrace": "   在...",
    "ExceptionType": "System.Security.SecurityException"
}

原因分析

ASP.NET应用程序运行的账户没有权限创建和写入 Windows 事件日志源(Event Source),在Windows Server 2008 中事件日志的创建、写入需要管理员级别的权限,而默认的 IIS 应用程序池账户(如 IIS AppPool\应用池名称Network Service 等)权限不足。

解决方案

(1)以管理员身份运行命令:

eventcreate /ID 1 /L APPLICATION /T INFORMATION /SO ExceptionManagerPublishedException /D "Created event source for JKCFlowPlatform"

image

 执行成功会提示 SUCCESS: An event of type 'INFORMATION' was created in the 'APPLICATION' log with 'ExceptionManagerPublishedException' as the source.

(2)在事件查看器“Windows 日志”→“应用程序”查看ExceptionManagerPublishedException,能看到刚创建的信息事件即表示成功。

image

 

posted @ 2026-01-08 11:27  我也是个傻瓜  阅读(7)  评论(0)    收藏  举报