C#: GUI to display realtime messages from Windows Service

What you can do is have the windows service have way of registering for an event (you can do this through using Windows Communication Foundation). When your error comes up, it fires that event, and your winforms app will be notified. It’s called a duplex contract: http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/0eb69998-0388-4731-913e-fb205528d374/ http://msdn.microsoft.com/en-us/library/ms731184.aspx Actually the really cool thing is that … Read more

The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security [duplicate]

See creating a registry key. This problem can occur not only due to permissions, but also due to event source key missing because it wasn’t registered successfully (you need admin privileges to do it – if you just open Visual Studio as usual and run the program normally it won’t be enough). Make sure that … Read more

What do I need to change to allow my IIS7 ASP.Net 3.5 application to create an event source and log events to Windows EventLog?

I’ve copied this answer from here (the question was Log4Net but the answer still applies). The technet link misses a vital step. Create a registry key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\eventlog\Application\MY-AWESOME-APP Create a string value inside this Name it EventMessageFile, set its value to C:\Windows\Microsoft.NET\Framework\v2.0.50727\EventLogMessages.dll That path appears to work in both 64 bit and 32 bit environments. With … Read more

The source was not found, but some or all event logs could not be searched

EventLog.SourceExists enumerates through the subkeys of HKLM\SYSTEM\CurrentControlSet\services\eventlog to see if it contains a subkey with the specified name. If the user account under which the code is running does not have read access to a subkey that it attempts to access (in your case, the Security subkey) before finding the target source, you will see … Read more

Description for event id from source cannot be found

I got this error after creating an event source under the Application Log from the command line using “EventCreate”. This command creates a new key under: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application If you look at the Key that’s been created (e.g. SourceTest) there will be a string value calledEventMessageFile, which for me was set to %SystemRoot%\System32\EventCreate.exe. Change this to … Read more

How to create Windows EventLog source from command line?

Try “eventcreate.exe” An example: eventcreate /ID 1 /L APPLICATION /T INFORMATION /SO MYEVENTSOURCE /D “My first log” This will create a new event source named MYEVENTSOURCE under APPLICATION event log as INFORMATION event type. I think this utility is included only from XP onwards. Further reading Windows IT Pro: JSI Tip 5487. Windows XP includes … Read more

How do you create an event log source using WiX

Wix has out-of-the-box support for creating event log sources. Assuming you use Wix 3, you first need to add a reference to WixUtilExtension to either your Votive project or the command line. You can then add an EventSource element under a component : <Wix xmlns=”http://schemas.microsoft.com/wix/2006/wi” xmlns:util=”http://schemas.microsoft.com/wix/UtilExtension”> <Component …> … <util:EventSource Log=”Application” Name=”*source name*” EventMessageFile=”*path to … Read more

System.Security.SecurityException when writing to Event Log

To give Network Service read permission on the EventLog/Security key (as suggested by Firenzi and royrules22) follow instructions from http://geekswithblogs.net/timh/archive/2005/10/05/56029.aspx Open the Registry Editor: Select Start then Run Enter regedt32 or regedit Navigate/expand to the following key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Security Right click on this entry and select Permissions Add the Network Service user Give it Read permission … Read more