0

Below are different code I have used but I need to execute ETL or batch file gave link to button dashbord via view page but I couldn't execute or run file please suggest me on same

public ActionResult RunETL(){
    try
    {
        System.Diagnostics.Process p = new System.Diagnostics.Process();
        p.StartInfo = new System.Diagnostics.ProcessStartInfo(@"D:\Jobs\Execute");
        p.Start();


        //Process p = new Process();
        //// Redirect the output stream of the child process.
        //p.StartInfo.UseShellExecute = false;
        //p.StartInfo.RedirectStandardOutput = true;
        ////p.StartInfo.FileName = @"D:\Jobs\Execute";

        //p.Start();
        //// Do not wait for the child process to exit before
        //// reading to the end of its redirected stream.
        //p.WaitForExit();
        //// Read the output stream first and then wait.
        //string output = p.StandardOutput.ReadToEnd();
        //p.WaitForExit();
        //Response.Write("Done");
        ////ViewBag.Result = "ETL Running";
    }
    catch (Exception ex)
    {

        //ViewBag.Result = ex.Message;

    }

    return RedirectToAction("Home");
}
Bobby
  • 3
  • 1
  • 4
  • Where do you want to run it? On the client or the server? Furthermore `couldn't execute or run file` is not a sufficient description of a problem. – jAC Nov 21 '17 at 09:40
  • have developed application through which need to run in ma pc server – Bobby Nov 21 '17 at 09:42
  • 2
    Possible duplicate of [Executing Batch File in C#](https://stackoverflow.com/questions/5519328/executing-batch-file-in-c-sharp) – Curiousdev Nov 21 '17 at 09:43

1 Answers1

0

have a Look at the Application Pool Identity that's used to run your web app.

it should have a Execute Right on the location of the batch file.

gadasadox
  • 109
  • 1
  • 9