Re: C# servicecontroller permissions

From: Rick Strahl [MVP] (rickstrahl_at_hotmail.com)
Date: 03/16/04


Date: Mon, 15 Mar 2004 21:15:13 -1000


I think the problem is that you don't have rights to start a service on the
remote machine. The ASP.Net account on *YOUR* machine is an admin because
you added it but it either doesn't exist on the remote server or has a
different password (since it's an autocreated account) and thus you can't
connect through to the other machine.

A workaround for this is to use Impersonation for your request in some way
(using a special directory and setting security to Impersonate possibly) or
by changing the account that runs your ASP.net application (in the Win3k
ApplicationPool's Impersonation or Win2k ProcessModel section in
machine.config). If you do the latter you have to use an account that has
admin rights on both machines and exists as hte same account on both (either
a domain account or a local account that exists on both machines). Note that
built in accounts like ASPNet or System won't work for this since these are
local accounts with auto-assigned passwords that you can't change.

Hope this helps,

+++ Rick ---

-- 
Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/weblog/
----------------------------------
Making waves on the Web
"batwater" <anonymous@discussions.microsoft.com> wrote in message
news:F7D453F4-42E9-465B-A502-73FA51544C06@microsoft.com...
> I am trying to restart a service on a remote machine through C#.  I am an
administrator for that machine and can control the service on the remote pc
though the "Services" app in the Administator Tools on my pc.  I have also
added ASPNET as an administrator to the remote machine (just for testing
purposes).  I can view all of the services on the remote machine with my C#
program, but when I try and start or stop a service, I get an error stating
the service was not found even though it exists on the machine and is
displayed through ServiceController.GetServices('remote-pc').  I was
wondering if there is any security or permission issues that I need to be
concerned with.  My local pc is running XP pro and the remote pc is running
NT.
>
> Note: This code works flawlessly on my local machine.
> I am using the code that was cut and pasted from
http://www.aspemporium.com/aspEmporium/cshrp/howtos/howto.asp?hid=7
>
> Exception that is received:
> An unhandled exception of type 'System.InvalidOperationException' occurred
in system.serviceprocess.dll
>
> Additional information: Service myservice was not found on computer
'remote-pc'.
>
> This exception shows up even though I know the service (not misspelled)
exists on the remote pc (not misspelled).  Does anyone know why this would
be happening?  Any help is appreciated!
>
> -batwater


Relevant Pages

  • Re: asp.net remote [hosted] configuration usse
    ... That includes machine admin rights. ... to manipulate the that one site, one of many on a remote PC running Win2k3. ... The FrontPage Server Extensions Access Method ... Create an account on the remote Web Server. ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: How to remote access Windows XP Pro computer?
    ... you happen to use Norton Internet Security please read the following link. ... link for the remote person to access their system. ... "Is LogMeIn secure and what is SSL? ... separate passwords to access both your LogMeIn account and your Target ...
    (microsoft.public.windowsxp.work_remotely)
  • Re: RWW and Remote desktop stopped working on all clients
    ... After diggin through ALL the group policies, I found Remote ... Desktop DISABLED under the Account Lockout policy - I don't think I've even ... adminsitrator or another account with Domain Admin role; also the server ...
    (microsoft.public.windows.server.sbs)
  • Re: DomainLocalServer$ is not a valid user
    ... I have traced by SQL-profiler on remote computer. ... it's always traced the user account. ... Its Security is ... to use the current user credential to logon to the remote server. ...
    (microsoft.public.sqlserver.security)
  • Network share as a Publishing Point source
    ... Give the common user appropriate permissions on folders, ... publishing points, ... >original account would keep me from mapping a publishing ... >>>I tried setting up a remote share for WM9 Services, ...
    (microsoft.public.windowsmedia.server)