Security Issue in Service

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • bthubbard

    #1

    Security Issue in Service

    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.Securit y.SecurityExcep tion' 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.WriteE ntry.
    I've found the support article
    http://support.microsoft.com/?kbid=918122 and have added the

    EventLogPermiss ion eventLogPermiss ion = new
    EventLogPermiss ion(EventLogPer missionAccess.A dminister, ".");
    eventLogPermiss ion.PermitOnly( ); to no avail.

    Any help would be greatly appreciated.

  • Willy Denoyette [MVP]

    #2
    Re: Security Issue in Service


    "bthubbard" <Brandon.Hubbar d@gmail.comwrot e in message
    news:1161951201 .990272.298360@ f16g2000cwb.goo glegroups.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.Securit y.SecurityExcep tion' 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.WriteE ntry.
    | I've found the support article
    | http://support.microsoft.com/?kbid=918122 and have added the
    |
    | EventLogPermiss ion eventLogPermiss ion = new
    | EventLogPermiss ion(EventLogPer missionAccess.A dminister, ".");
    | eventLogPermiss ion.PermitOnly( ); to no avail.
    |
    | Any help would be greatly appreciated.
    |

    My guess is that your service attempts to create a "private log", only
    admininstrator accounts have the right to "create" private logs. If your
    service runs as localservice or networkservice (as it should), it won't be
    able to create the log, so, you'll have to create the log from another
    program, not from within your service.
    Willy.



    Comment

    Working...