Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Security > Using ServiceController to remotely administer windows services

Reply
Thread Tools

Using ServiceController to remotely administer windows services

 
 
Tony201
Guest
Posts: n/a
 
      06-08-2009
Hi All,

I have an application that uses ASP.NET to control windows services on
various remote windows 2003 servers. Furthermore the application queries an
SQL Server database using integrated authentication. I have setup a domain
user to run my app pool for this application and setup constrained delegation
to allow integrated authentication for SQL Server. All works well on my
development XP machine and when I move the application to the server, SQL
Server access is fine but I get an error when I try to query the services.
However, when I turn impersonation off in web.config, SQL Server access fails
(as expected) but querying windows services works (NOTE: that my app pool
account is admin on all servers concerned so permission shouldn't be an
issue).

My question is
Is it possible to impersonate a user to control a service on a remote machine?
If so, do I need to setup an SPN for this or do some other configuration?
If I need to setup an SPN, what is the service type of the Service
Controller Manager and what account do I need to setup this SPN for?

Error message when impersonation is turned on
[Win32Exception (0x80004005): Access is denied]

[InvalidOperationException: Cannot open Service Control Manager on computer
'serverxxxx'. This operation might require other privileges.]

System.ServiceProcess.ServiceController.GetDataBas eHandleWithAccess(String
machineName, Int32 serviceControlManaqerAccess) +35775

System.ServiceProcess.ServiceController.GetDataBas eHandleWithEnumerateAccess(String machineName) +9
System.ServiceProcess.ServiceController.GetService sOfType(String
machineName, Int32 serviceType) +143
System.ServiceProcess.ServiceController.GetService s(String machineName) +9
AutonomyAdmin.test.test2() +400
AutonomyAdmin.test.Page_Load(Object sender, EventArgs e) +137
System.Web.Util.CalliHelper.EventArgFunctionCaller (IntPtr fp, Object o,
Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Cal lback(Object sender,
EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +50
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627



Code used to query Windows Services
private void test1()
{
BoundColumn serviceName = new BoundColumn();
serviceName.DataField = "displayName";
serviceName.HeaderText = "Service Name";
serviceName.ItemStyle.CssClass = autnCssConstants.cssServerColumn;

//Initialise datagrid
DataGrid dGrid = new DataGrid();
dGrid.CssClass = autnCssConstants.cssDatabaseTable;
dGrid.EnableViewState = false;
dGrid.HeaderStyle.CssClass =
autnCssConstants.cssDatabaseTableHeader;
dGrid.AlternatingItemStyle.CssClass =
autnCssConstants.cssAlternateRow;
dGrid.AutoGenerateColumns = false;

//Add columns
dGrid.Columns.Add(serviceName);

//Bind data
dGrid.DataSource = ServiceController.GetServices("serverxxxx");
dGrid.DataBind();
this.form1.Controls.Add(dGrid);
}








 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using ServiceController to remotely administer windows services Tony201 ASP .Net Security 0 06-08-2009 03:25 PM
How to use ServiceController Amil ASP .Net Security 0 02-03-2004 03:50 AM
serviceController running on IIS. Tony Tortora ASP .Net Security 0 02-02-2004 09:36 PM
ServiceController and "Access Denied" errors Ron ASP .Net 1 11-18-2003 04:02 PM
Administer IIS from ASP.NET Stefan Landgraf ASP .Net 0 10-28-2003 08:52 AM



Advertisments