I am unable to see event log in WINDOW7 professional for my window service.
My code is:
private const string sourceName = "SampleWindowService";
protected override void OnStart(string[] args)
{
try
{
//log to track activity of window service
if (!System.Diagnostics.EventLog.SourceExists(sourceName))
{
System.Diagnostics.EventLog.CreateEventSource(sourceName, "DemoService");
}
this.EventLog.Source = sourceName;
this.EventLog.Log = "DemoService";
this.EventLog.WriteEntry("Service started successfully");
time.Start();
time.Enabled = true;
time.Interval = 60000;
time.Elapsed += new ElapsedEventHandler(OnElapsedTime);
}
catch (Exception ex)
{
// ExceptionLogger.LogException(ex);
}
}
Service is running.But event log is not visible.
Can any one give me steps to view it.
thank in advance