Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / March 2008

Tip: Looking for answers? Try searching our database.

Client App Fails to stop Service

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
RML - 25 Mar 2008 18:01 GMT
Hi,

I have created a .Net 2.0 Windows Service which I would like to have
stopped/Started by a .Net 2.0 client windows app.

When logged in as Admin, the client app can start/stop the service fine.  If
I am logged in as a user other than Admin, the client fails to stop/start the
service.  The error is as follows:

"Cannot open Foo Service on Computer."

I would guess that this is a permission problem, so I looked into the
ServiceControllerPermissions clas, but the documentation is not clear on how
to impliment it.

Is this the right class to use, and if so how do I use it?

RM
Jeroen Mostert - 25 Mar 2008 22:10 GMT
> I have created a .Net 2.0 Windows Service which I would like to have
> stopped/Started by a .Net 2.0 client windows app.
[quoted text clipped - 6 lines]
>
> I would guess that this is a permission problem,

This is correct. Like most other objects, every service has a DACL
associated with it. By default, service DACLs only allow administrators,
power users and LocalSystem permission to start and stop the service. This
is usually what you want, since services often run in a highly privileged
context.

> so I looked into the ServiceControllerPermissions clas, but the
> documentation is not clear on how to impliment it.
>
> Is this the right class to use, and if so how do I use it?

No, it's not. ServiceControllerPermission is for code access security only,
and offers an extra layer of security for managed code. That's not what's
stopping you -- the unmanaged permissions on the service are.

Here's a KB article on service DACLs and the risks associated with changing
them: http://support.microsoft.com/kb/914392

Here's a freeware tool to change them which is slightly more intuitive than
"sc" (I didn't test it): http://www.losoft.de/ls_scacl.html

Signature

J.


Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.