1

My code works locally, but not when I deploy to my web server. It says, "Permission Denied," when trying to access the wkhtmltopdf.exe file. I am using the Codaxy Wrapper.

WkHtmlToPdfPath = HttpContext.Current.Server.MapPath(@"~/wkhtmltopdf/wkhtmltopdf.exe"), 

Could I change that to using a DLL or something? How can I make this work on the server like it works locally?

11
  • 1
    Check this SO link Commented Mar 8, 2013 at 1:57
  • This smells like a UAC or even generic permissions thing. Commented Mar 8, 2013 at 1:57
  • Did you try adding Network Service user and gave it Full Control? Commented Mar 8, 2013 at 1:59
  • It is never a good idea to have your web server kick off a new process. Commented Mar 8, 2013 at 2:05
  • Dup of one suggested by dan radu. Note that linked answers also cover security issues brought by Dan-o. Commented Mar 8, 2013 at 2:08

1 Answer 1

4

You need to grant execute access on the .exe file to the user IIS is going to use to access the file, most likely the app pool identity or in IIS 6 the IIS_WPG user.

Sign up to request clarification or add additional context in comments.

9 Comments

How can I grant the user access? Is this done via VS 2010 or my web control panel? I am on a shared server. Thanks for your help.
This did work for solving the problem. But, I have a new problem, for which I will open a new question, if need be... Thanks! (Value cannot be null. Parameter name: fileContents)
In reply to "How can I grant the user access? Is this done via VS 2010 or my web control panel? I am on a shared server. Thanks for your help. – user1477388 2 days ago" You need to assign the permission on the file system. e.g. if the file is located at C:\Program Files\7-Zip\7z.exe you need to navigate windows explorer to the c:\Program Files\7-Zip\ folder, right click on the 7z.exe file and adjust the security settings bu adding the iis app pool identity user.
Sorry, super slow reply. Granting access to the .exe is done in windows explorer. right click the .exe, --> properties --> security.
I would say any elevation of privileges does create the potential for security issues. However we must issue at least the bare minimum ACLs or else our application will get access denied type errors. To run an .exe execute permission is needed. Write permission if not needed. However, the .exe itself may be carrying out a write operation, in that even then write permissions will be needed on the directories .exe writes to.
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.