Error while writing to event log, prevents windows service from starting?

后端 未结 2 448
孤街浪徒
孤街浪徒 2021-01-11 15:28

I am using the following code to create a custom event log in my windows service application:

public ServiceConstructor()
{         


        
2条回答
  •  暖寄归人
    2021-01-11 16:08

    Try the following:

    EventLog.CreateEventSource("WinService", "Application");
    and eventLog1.Log = "Application";

    Also put the following in OnStart:

    eventLog1.Log="Application"
    eventLog1.Source = "WinService";

提交回复
热议问题