I want to call an .exe that is on my Windows machine. I publish the site to a folder inside "C:\inetpub\wwwroot" and can call the API from outside. Problem is when I run the code from VS on IIS Express the exit code of the process is 0 and the exe is executed successfully, but when I call the Action Result from outside and it runs on the IIS the status code is 1 and there is obviously a problem with this process calling: Here is my code:
public async Task<ActionResult> url2img(string url)
{
Process proc = new Process();
proc.StartInfo.FileName = @"C:\Program Files\wkhtmltopdf\bin\wkhtmltoimage.exe";
proc.StartInfo.Arguments = $"--encoding utf-8 \"{url}\" {FilePath}";
proc.Start();
proc.WaitForExit();
object oJSON = new { procStatusCode = proc.ExitCode };
proc.Close();
return Json(oJSON, JsonRequestBehavior.AllowGet);
}
I found this thread, and read the proposed answer by the OP, but I cannot find "load windows profile" in my IIS and also I am not sure if this is the same issue as his? Any help?