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: Cannot open log for source 'MySource'. You may not have write access. ---> System.ComponentModel.Win32Exception: Access is denied
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.
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.