Re: Windows Service - Event Log



Check your service account, only admin accounts have the right to "create"
private logs. If your service run with restricted privileges (which is
good), you'll need to create the log from another program, not from within
your service.

Willy.


<pisquem@xxxxxxxxxxx> wrote in message
news:1151433999.353419.127040@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|I am building an windows service that is to be deployed on a windows
| server 2003 and I want to have activity written to the event log, I
| want its own log called ('CustomLog')
|
| Below is what I have so far...its builds fine but when I go to start
| the service i get the following error.
|
| ---------------------------
| Services
| ---------------------------
| The CWindowService service on Local Computer started and then stopped.
| Some services stop automatically if they have no work to do, for
| example, the Performance Logs and Alerts service.
| ---------------------------
| OK
| ---------------------------
|
|
| What am I doing wrong? Right after this code I have this line....and it
| never had an issue.
| EventLog.WriteEntry("Refresh started successfully.");
|
| //1. Create the source, if it does not already exist.
| if (!EventLog.SourceExists("CustomLog"))
| {
| EventLog.CreateEventSource("CustomLog", "MyNewLog");
| }
|
|
| //2. Create an EventLog instance and assign its source.
| EventLog myLog = new EventLog();
| myLog.Source = "CustomLog";
|
|
| //3. Write an informational entry to the event log.
| myLog.WriteEntry("Writing to event log.");
|


.



Relevant Pages

  • Windows Service - Event Log
    ... I am building an windows service that is to be deployed on a windows ... server 2003 and I want to have activity written to the event log, ... Create an EventLog instance and assign its source. ... Write an informational entry to the event log. ...
    (microsoft.public.dotnet.languages.csharp)
  • iis 6 exception issue
    ... We have a customer who is experiencing several issues after migrating their ... make sense due to the security changes in iis 6 compared to 5. ... the domain service account, ... No errors are reported in the event log when an 'empty' executable is called ...
    (microsoft.public.inetserver.iis.security)
  • Re: sql server does not exist
    ... You can change the service account to Local System via Windows service ... Repeat for SQL Server agent. ...
    (microsoft.public.sqlserver.server)
  • Re: How can I raise WinForm from WinService ?
    ... The windows service is running in it's own service account and which has it ... I think Chris's suggestion on let a ... remote client show a UI and communicate with the serivice via any other ...
    (microsoft.public.dotnet.framework)
  • Running STSADM without being in local Administrator group?
    ... This process works if I place the service account into the ... When this occurs I get a failure audit in the Application Event Log: ... Privileged Service Called: ...
    (microsoft.public.sharepoint.windowsservices)

Loading