private void StartService(string serviceName, int timeoutMilliseconds) { Configuration objConfigFile; //getting an instance of the configuration file objConfigFile = WebConfigurationManager.OpenWebConfiguration( HttpContext.Current.Request.ApplicationPath); //getting an instance of the "identity" section of the cofiguration file IdentitySection objIdentitySection =(IdentitySection)objConfigFile.GetSection("system.web/identity"); //Checking the domain,username and password credentails by Alex on Jan 8,2014 if (objIdentitySection != null) { string username = objIdentitySection.UserName; string password = objIdentitySection.Password; bool impersonate = objIdentitySection.Impersonate; if (impersonate == true) { ServiceController service = new ServiceController(@"D:\C3sps Project\COMMON\Source\Untested\C3psps\C3PSPS_SOD\bin\Debug\C3PSPS_SOD.exe"); try { TimeSpan timeout = TimeSpan.FromMilliseconds(timeoutMilliseconds); service.Start(); service.WaitForStatus(ServiceControllerStatus.Running, timeout); return; } } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)