EventLogPermission, EventLog and no user logged.

B

BLUE

EventLogPermission permission =
new EventLogPermission(EventLogPermissionAccess.Administer, ".");
permission.PermitOnly();

If I use the above statements before CreateEventSource when I go to Event
Viewer i see:

The description for Event ID (0) in Source (GTJR) cannot be found.
The local computer may not have the necessary registry information or
message DLL files to display messages from a remote computer.
You may be able to use the /AUXSOURCE = flag to retrieve this description.
See Help and Support for details.
The following information is part of the event: Hello world.


I do not understand from MSDN if we must use EventLogPermission or if they
are optional.


I want to run an app on a server (so when no user is logged) and to log its
events:

- which are user permissions when no user is logged?

- what is the user when no user is logged?
I test if he is an administrator to create an event source:
WindowsPrincipal principal = new
WindowsPrincipal(WindowsIdentity.GetCurrent());
return principal.IsInRole(WindowsBuiltInRole.Administrator);

- to schedule the run I can use task scheduler or it does not work when no
user is logged and I have to create a windows service?


Thanks,
Luigi.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top