Unless I make the account under which my Windows Service runs a member of
local Administrators, I get startup failures if I include the following code
in the OnStart() event :
if(!EventLog.SourceExists("MyLog"))
{
EventLog.CreateEventSource("My Log", "Application");
}
EventLog appLog = new EventLog();
appLog.Source = eventSource;
appLog.WriteEntry("Test Log Entry",EventLogEntryType.Information);
Seems extreme to make a Service's credentials a member of local
Administrators ... any ideas ? 2 1571
Hi John,
In order to create a new Event Source, you need to be a member of the
Administrators group. One workaround is to have a separate program that
creates the source for you, then you can run just this program from an
admin account, and your service can still run under "non-admin" credentials.
Regards,
Bennie Haelen
John Grandy wrote: Unless I make the account under which my Windows Service runs a member of local Administrators, I get startup failures if I include the following code in the OnStart() event :
if(!EventLog.SourceExists("MyLog")) { EventLog.CreateEventSource("My Log", "Application"); } EventLog appLog = new EventLog(); appLog.Source = eventSource; appLog.WriteEntry("Test Log Entry",EventLogEntryType.Information);
Seems extreme to make a Service's credentials a member of local Administrators ... any ideas ?
Hi John,
In order to create a new Event Source, you need to be a member of the
Administrators group. One workaround is to have a separate program that
creates the source for you, then you can run just this program from an
admin account, and your service can still run under "non-admin" credentials.
Regards,
Bennie Haelen
John Grandy wrote: Unless I make the account under which my Windows Service runs a member of local Administrators, I get startup failures if I include the following code in the OnStart() event :
if(!EventLog.SourceExists("MyLog")) { EventLog.CreateEventSource("My Log", "Application"); } EventLog appLog = new EventLog(); appLog.Source = eventSource; appLog.WriteEntry("Test Log Entry",EventLogEntryType.Information);
Seems extreme to make a Service's credentials a member of local Administrators ... any ideas ? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Bill Sonia |
last post by:
I've written a Windows Service to send e-mails on events like OnStart,
OnStop, OnShutDown using System.Web.Mail. It works for everything but
OnShutdown. My guess is that for OnShutDown, once my...
|
by: Chris Dunaway |
last post by:
I am attempting to use the AppDomain.UnhandledException event in a
Windows Forms app and also in a Windows Service. But the event doesn't
seem to be called.
In a Windows Forms app, the event IS...
|
by: pisquem |
last post by:
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...
|
by: Jason |
last post by:
Ok, for the life of me, I just don't understand what's going on. I want to
use remoting to send messages from a windows service to a windows form app,
but I just can't get it to work. So, here's...
|
by: dm3281 |
last post by:
I'm really starting to hate writing services -- or trying to, anyway.
Why do I need to rename my project to the service name?
Why do I need to set the "ServiceName" property to my service name?...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |