(1) I tried to use what seems like a standard line (from Walkthrough:
Creating a Windows Service Application in the Component Designer at
http://msdn2.microsoft.com/en-us/lib...t39148a.aspx):
if (!System.Diagnostics.EventLog.SourceExists("MySour ce")) { ...
But received this error when attempting to start the service:
System.Security.SecurityException was unhandled
Message: The source was not found, but some or all event logs could not
be searched. Inaccessible logs: Security.
(2) Per the walkthrough, I had set up the account on the
ServiceProcessInstaller to LocalService, which I assumed had insufficent
privilege. So I tried to recompile after setting this account to a
different choice. I then naively tried to install from the setup project
again, but got a message that the "service was marked for deletion" and I
needed to re-run the installer. But re-running gave the same message.
(3) I then tried to use "installutil /u MyNewService" to remove the
service outside of VS so I could re-install. But installutil did not
recognize the "/u" option! It just gave a list of "command/test/option
names". (This is on WinXP Pro.)
(4) So I re-launched VS and tried the installer again and this time it
installed successfully. But unfortunately, when I tried to start the
service, it produced the original error in (1) above.
Questions:
(A) Why am I getting a SecurityException and how can I get around it?
(B) What is the appropriate way to re-install a service?
(C) Why does installutil /u not work as advertised?