htmltools.exe Permission Problems when call from ASP.NET source code

I purchased the command line server product of HTML to PDF Converter and I am having a problem I need help with.  My application creates a series of .rtf files with each file containing a page for a carrier access bill. I use the htmltools.exe product to convert the pages from .rtf format to .pdf format.  I then use the htmltools.exe product to combine the resulting .pdf files to a single file.

The command line product is called from a compile perl script.  Here are the symptoms I am seeing;

When I run the command line product from a command window, it runs with very acceptable run times.

When I run the compiled perl program from a command line window, which calls the htmltools.exe product, it runs with very acceptable run times.

However, when I run the compiled perl program from my ASP.NET application, it starts the compiled perl program using a COM+ component that is impersonating my username, but I am getting very slow run times of htmltools.exe.

I created a log file to see what was happening and the results are attached.  It's getting a message saying 'StgCreateDocfile() function failed.' which is probably some sort of permissions problem, but I am not sure.

I have opened up the security for the folder in question allowing all access for Everyone, and the internal accounts used by ASP.NET.

Any suggestions you have would be greatly appreciated.
It seems the default account of ASP.NET application hasn't permission to calling the StgCreateDocfile() function, we suggest you may use CmdAsUser.exe to run htmltools.exe from an interactive user account (such as Administrator user account) to try again. CmdAsUser.exe can be downloaded from following web page,

CmdAsUser - start a command as a specified user. CmdAsUser command line is a freeware. (32.40 KB).

Usage: CmdAsUser <user> <domain> [/p <password>] [/c <command>]

<user> is the name of the user.
<domain> is the logon domain, specify a period '.' for local.
<password> (optional) is the users password.
<command> (optional) is the command line to execute as the specified

If the password is not given then you will be prompted for it.
If the command is not given then "cmd" is assumed.
The calling process needs to either have administrative privileges (ie in the local adminstrators group) or at LEAST the following privileges:
"Act as part of the operating system" (SeTcbPrivilege),
"Bypass traverse checking" (SeChangeNotifyPrivilege),
"Increase quotas" (SeIncreaseQuotaPrivilege),
"Replace a process level token" (SeAssignPrimaryTokenPrivilege).
The utility may take a while if there is inappropriate security so please be patient.


CmdAsUser Martyn . /p GingerNinja /c regedit
CmdAsUser test . /p 123 /c "C:\Program Files\docPrintPro v4.5\doc2pdf.exe" -i htttp:// -o "C:\out.pdf"

You may encounter Error 1314 in some Windows systems when you switch between user accounts, this is caused by permission setting, please by following steps to solve this 1314 Error,

ERROR 1314:
1314 A required privilege is not held by the client. ERROR_PRIVILEGE_NOT_HELD

To resolve this issue:
1. Click Start, click Run, type "secpol.msc", and then press ENTER.
2. Double-click "Local Policies".
3. Double-click "User Rights Assignment".
4. Double-click "Replace a process level token".
5. Click "Add", and then double-click the "Everyone" group
6. Click "OK".
7. You may have to logout or even reboot to have this change take effect.

Please refer to following two screenshots to understand above steps,

Please look at following page for the details about ERROR 1314,


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

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!