"无法打开日志源" - Windows 7的 - .NET Web服务 - 事件日志日志、无法打开、事件、QUOT

2023-09-04 04:59:10 作者:古城白衣少年殇

我有一个.NET Web服务正试图登录到Windows事件日志。但是,当我尝试SOAP请求在此Web服务发送给Web方法,我在SOAP响应返回此错误:

I have a .NET web service that is trying to log to the Windows Event Log. However, when I try to send a SOAP request to a web method in this web service, I get back this error in the SOAP response:

System.InvalidOperationException:无法打开日志源'MYSOURCE。您可能没有写权限。 ---> System.ComponentModel.Win32Exception:访问被拒绝

System.InvalidOperationException: Cannot open log for source 'MySource'. You may not have write access. ---> System.ComponentModel.Win32Exception: Access is denied

我已经试过周围的Googling寻求解决方案。 这一次介绍了编辑,我在Windows 7中不存在的注册表项64位;相同的此Microsoft页面。 This问题是相关的,但它的唯一的答案谈论一个'源'键似乎并没有在任何地方在HKEY_LOCAL_MACHINE \系统\ CurrentControlSet \服务\事件日志\ MYSOURCE。如果我需要添加源键,这是什么它的价值需要是什么?我用我的Web服务的Web.config模拟(<身份冒充=真/> )。 This问题相关很好,但没有答案。 This问题是相关的,但它再次回答似乎并没有涉及到注册表设置在Windows 7中。

I've tried Googling around for a solution. This one describes editing a registry key that does not exist for me in Windows 7 64-bit; same for this Microsoft page. This question is related but the only answer to it talks about a 'Source' key that does not seem to be anywhere in HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\eventlog\MySource. If I need to add a Source key, what does its value need to be? I am using impersonation in my web service's Web.config (<identity impersonate="true" />). This question is related as well but has no answers. This question is related but again its answer doesn't seem to pertain to the registry setup in Windows 7.

我有两个&LT;身份验证模式=窗口/&GT; &LT;身份冒充=真/&GT; 在我的Web.config设置。但是,即使我删除&LT;身份验证模式=窗口/&GT; ,我仍然得到无法打开日志源错误

I have both <authentication mode="Windows" /> and <identity impersonate="true" /> set in my Web.config. However, even when I remove <authentication mode="Windows" />, I still get the "Cannot open log for source" error.

推荐答案

我有完全相同的问题,在Windows 7 64位我的经典ASP Web应用程序。我最终发现,通过更改应用程序池,该网站为启用32位应用程序(右键单击应用程序池,高级设置),问题就消失了。谈论一个红鲱鱼的错误信息!不管怎么说,希望这可以帮助别人......

I was having the exact same problem in Windows 7 64 bit for my classic asp web application. I eventually found that by changing the application pool for that website to "Enable 32-bit Applications" (right-click application pool, advanced settings) the problem disappeared. Talk about a red herring error message! Anyway, hopefully this helps someone...