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"

执行成功会提示 SUCCESS: An event of type 'INFORMATION' was created in the 'APPLICATION' log with 'ExceptionManagerPublishedException' as the source.
(2)在事件查看器“Windows 日志”→“应用程序”查看ExceptionManagerPublishedException,能看到刚创建的信息事件即表示成功。

作者:我也是个傻瓜
出处:http://www.cnblogs.com/liweis/
签名:成熟是一种明亮而不刺眼的光辉。

浙公网安备 33010602011771号