简体   繁体   中英

Process Start in IIS

Want to execute a exe within Application directory, in Dev system it works fine. In IIS, it is not executed, I have tried below points:

set default application pool to local system

set defualtpool, NETWORK_SERVICE, Everyone access to exe

Enabled 32 bit application to application pool

Server Version : Windows Server 2012

IIS Version: IIS 8.0

Below is my code

 p.StartInfo = new ProcessStartInfo();

p.StartInfo.UseShellExecute = false;

p.StartInfo.RedirectStandardOutput = true;

p.StartInfo.FileName = System.AppDomain.CurrentDomain.BaseDirectory.ToString() + "wkhtmltopdf\\wkhtmltopdf.exe";      

string arg1 = "";

arg1 = "www.google.com" + " test.pdf";

p.StartInfo.Arguments = arg1;

p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;

p.StartInfo.CreateNoWindow = true;

p.Start();          

p.WaitForExit(60000);

p.Close();

p.Dispose();

Make sure that the location at which your pdf file is getting generated "everyone has access to it"

it seems you are trying to convert html data to pdf file on your iis server. Make sure IIS server can access the site which your are trying to convert "Check if you can access those site using IE on your IIS server as there could be proxy issues"

Consider to set the working path of your exe:

 p.StartInfo.WorkingDirectory = System.AppDomain.CurrentDomain.BaseDirectory.ToString() + "wkhtmltopdf";

Also check task manager if the exe is in memory. Sometimes when a batch got a low level error open a prompt, and IIS do not capture it, so the process is freezed in memory.

Consider also the set a log in the exe in order to understand what goes wrong.

I had similar problem. Solved moving the exe in another folder outside IIS application. This folder should have execution rights.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM