You must Sign In to post a response.
  • Category: Webservices

    Need web service to start the process

    Hi,
    I need the Asp.Net web service to start any process(for example: web service to start the calculator using calc.exe)that need to be run in the windows server 2008...
  • #758498
    In asmx page You can call the Below code...



    string locn = ConfigurationManager.AppSettings["EXELOC"];
    Process myProcess = new Process();

    myProcess.StartInfo.UseShellExecute = false;
    myProcess.StartInfo.FileName = locn + "DoComplexTask.exe";
    myProcess.StartInfo.CreateNoWindow = true;
    myProcess.Start();


    SRI RAMA PHANI BHUSHAN KAMBHAMPATI

  • #766062
    Nice post. Sorry to say that I have no idea, but after reading this discussion, I know that web service need to start the process. I hosted my website on Mywindowshosting.com,which provides hosting services. Continue discussion so that those who have no idea can get something.

  • #766080
    Hi,
    This is because the process you are executing from web service will not start in the same context/same rights as the client browser, and may not have access like user machine.
    You have to change the Process Model Settings from IIS i.e. change Application Pool identity of your hosted application to "LocalSystem" because it has high-level user rights.
    Just follow these steps:
    Open IIS managerIn IIS Manager==> Click on Application Pool==> Select your Application Pool==> Right click and goto Advanced Settings==> Click on Identity (Bydefault ApplicationPoolIdentity is set)==> Change it to "LocalSystem".
    Please find attached image.

  • #766130
    why you need web service then, just create a windows service and call desired exe. you can call windows service from asp.net directly
    use 'ServiceController ' class to call it.
    see below snippet

    public static void StartService(string serviceName, int timeoutMilliseconds)
    {
    ServiceController service = new ServiceController(serviceName);
    try
    {
    TimeSpan timeout = TimeSpan.FromMilliseconds(timeoutMilliseconds);

    service.Start();
    service.WaitForStatus(ServiceControllerStatus.Running, timeout);
    }
    catch
    {
    // ...
    }
    }

    hope it helps

    Thanks
    Koolprasd2003
    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]


  • Sign In to post your comments