Access is denied when call htmltools.exe application from C# source code

Hello,

I recently moved an asp.net website application to a new server, and now when I attempt to generate a PDF based on an HTML document, I am getting this error:

Access is denied

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ComponentModel.Win32Exception: Access is denied

Source Error:

Line 120:
Line 121: procPrint.StartInfo = psiStarter
Line 122: procPrint.Start()
Line 123:
Line 124:

Source File: C:\Inetpub\vhosts\httpdocs\App_Code\VeryPDF.vb Line: 122

Customer
---------------------------------------------------------
Hello,

I am still unable to get this to work. Please see below the full stack trace. I have also tried running htmltools.exe from command line, but it says 'You have 297 time to evaluate this product...', and also 'result = ERROR TickCount = 9ms, Result = 0'.

What is the name of the .exe file I should run to install the full version on the server?

Do I need to grant any permissions to files to get this to work from the asp.net application?

I have the original exe file (htmltools.exe) copied from our old server so that is not the issue. I just need assistance with resolving the permissions error.

Thanks,

Server Error in '/' Application.
Access is denied
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ComponentModel.Win32Exception: Access is denied

Source Error:

Line 120:
Line 121: procPrint.StartInfo = psiStarter
Line 122: procPrint.Start()
Line 123:
Line 124:

Source File: C:\Inetpub\vhosts\httpdocs\App_Code\VeryPDF.vb Line: 122

Stack Trace:

[Win32Exception (0x80004005): Access is denied]
System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo) +1806
System.Diagnostics.Process.Start() +69
VeryPDF.GeneratePDFFile(String pageURL, String pdfFileName) in C:\Inetpub\vhosts\httpdocs\App_Code\VeryPDF.vb:122
is_applications_Default.PageLoad(Object sender, EventArgs e) in C:\Inetpub\vhosts\httpdocs\applications\CompleteApplication.aspx.vb:53
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +50
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627

Version Information: Microsoft .NET Framework Version:2.0.50727.6400; ASP.NET Version:2.0.50727.6387

Customer
---------------------------------------------------------
Hello,

Regarding my original issue relating to 'access is denied'

System.ComponentModel.Win32Exception: Access is denied

I found answer here…

http://forums.asp.net/t/1668168.aspx/1

The application pool identity user did not have sufficient permissions for /bin folder. I granted this user modify permission to this folder which fixed the problem. I had granted modify access to this user for htmltools.exe, but had to apply same permission to entire /bin folder to get it to work.

Thanks.
Customer
---------------------------------------------------------

Appendix:

System.ComponentModel.Win32Exception: Access is denied

Hi everyone...

I get this exception when i try to search the text box .

If i search using a small value like 140987 it says Cannot find 140987, but when i try to search it with bigger value like 6433858456949695695 it throws dis exception.Following is  a small snap shot of the error.

Thanks

Line 213:        End If
Line 214:        Catch ex As Exception
Line 215:        EventLog.WriteEntry("Member Application", ex.Message)
Line 216:        'Debug.Fail(ex.Message)
Line 217:        Finally

---------------------------------------------------------

Hi,

If the access denied exception was cause by this sentence:

EventLog.WriteEntry("Member Application", ex.Message)

I assume that the account your application run under hasn't this privilege. So when you try to write in log file, the above exception will be thrown. I also guess this app account has not NTFS file or folder write permissions.

You need to check the current app account of user. If you use IIS 6.0, NETWORK SERVICE is the account. If you use IIS 7, you need to find the which application pool your site running under and based on that pool, check the application pool identity to see if this identity has enough permission. More information about application pool identity, you can check these link:

http://learn.iis.net/page.aspx/624/application-pool-identities/

http://learn.iis.net/page.aspx/140/understanding-built-in-user-and-group-accounts-in-iis-7/

Alternative way and what a simple way is to use impersonation to run ASP.NET under an account that has permission in a secure context, and also you can assign a specific username and password for this account.

Check:.

http://msdn.microsoft.com/en-us/library/xh507fc5(v=VS.100).aspx

Here's a good article you can also have a look at:

http://www.west-wind.com/weblog/posts/2153.aspx

Hope this can help you.

---------------------------------------------------------

Thanks a Lot for your Help..!!!

Regards
XXXXX

VN:F [1.9.20_1166]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.20_1166]
Rating: 0 (from 0 votes)

Related Posts

This entry was posted in HTML Converter (htmltools) and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *


Verify Code   If you cannot see the CheckCode image,please refresh the page again!