Home All Groups Group Topic Archive Search About

Windows Service Security Problem

Author
27 Oct 2006 12:13 PM
bthubbard
Hello All,
I've run into a bit of an issue and I was hoping that someone here
could help me.  I have inherited a Windows Service written in .Net 2.0
(C#) from a previous employee.  It build successfully and I am able to
install it on the target machine via installutil but when I attempt to
run it I receive a security error.  First I receive the dialog telling
me that the service could not be started "Error 1053: The service
did..."  and then "An unhandled exception of type
'System.Security.SecurityException' occurred in System.dll" .  I've
tried running the service on my local machine and opening the CLR
debugger and the errors seems to be related to EventLog.WriteEntry.
I've found the support article
http://support.microsoft.com/?kbid=918122 and have added the

EventLogPermission eventLogPermission = new
EventLogPermission(EventLogPermissionAccess.Administer, ".");
eventLogPermission.PermitOnly(); to no avail.

Any help would be greatly appreciated.

Author
27 Oct 2006 12:42 PM
Kevin Spencer
Make sure the Service is running under a user account that has the
permissions necessary.

--
HTH,

Kevin Spencer
Microsoft MVP
Short Order Coder
http://unclechutney.blogspot.com

The devil is in the yada yada yada


Show quote
"bthubbard" <Brandon.Hubb***@gmail.com> wrote in message
news:1161951234.716930.326680@b28g2000cwb.googlegroups.com...
> Hello All,
> I've run into a bit of an issue and I was hoping that someone here
> could help me.  I have inherited a Windows Service written in .Net 2.0
> (C#) from a previous employee.  It build successfully and I am able to
> install it on the target machine via installutil but when I attempt to
> run it I receive a security error.  First I receive the dialog telling
> me that the service could not be started "Error 1053: The service
> did..."  and then "An unhandled exception of type
> 'System.Security.SecurityException' occurred in System.dll" .  I've
> tried running the service on my local machine and opening the CLR
> debugger and the errors seems to be related to EventLog.WriteEntry.
> I've found the support article
> http://support.microsoft.com/?kbid=918122 and have added the
>
> EventLogPermission eventLogPermission = new
> EventLogPermission(EventLogPermissionAccess.Administer, ".");
> eventLogPermission.PermitOnly(); to no avail.
>
> Any help would be greatly appreciated.
>

AddThis Social Bookmark Button