Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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<br />
<br />
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

C#
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();
Posted
Updated 24-Sep-15 13:52pm
v4
Comments
Herman<T>.Instance 24-Sep-15 11:24am    
Which settings differ between the 2 IIS instances?

1 solution

And the error message would be ...... ?

When everything is running on your DEV system, it's because the IIS Express server on your machine is running as YOU. The site code is running as YOU. They have all the same permissions you do.

When you deploy to a production server, the code is running as some service account in a very restricted sandbox, including being denied write-access to the folders in which the code is running. This is for security reasons.

I'm GUESSING that the tool you're running is either unable to write out the PDF file because the directory is read-only to the application pool account that your're using and/or the service cannot get out to the web because of permissions or some authentication problem if you have a proxy server your have to go through to get internet access.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900