Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8378745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:59:52+00:00 2026-06-09T15:59:52+00:00

I run a website with IIS 7.5 in classic ASP with an isolated Application

  • 0

I run a website with IIS 7.5 in classic ASP with an isolated Application Pool (ApplicationPoolIdentity). Inside this website I also run unmanaged code (wkhtmltopdf.exe) thru “WScript.Shell” object run method. After that I stream the result file as pdf

set wshell = CreateObject("WScript.Shell") 
wshell.run wkhtmltopdf.exe  http://www.mypagehanging.com c:\myfile.pdf", 0, TRUE 
set wshell = nothing 

Everything works fine but sometimes my Website Hang. It’s completely stuck. The wktmltopdf.exe running under the identity of the app pool (iis apppool\myapp) hangs.

This causes my all website to hang because i run the program with option bWaitOnReturn to true.

I cannot set this option to false because I must wait for the script to execute completely before streaming the pdf.

Couldn’t find any timeout option to give to wkhtmltopdf. Couldn’t understand why wkhtmltopdf was hanging. But it’s probably caused by the website I’m trying to render and not wkhtmltopdf.

Any suggestions ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T15:59:54+00:00Added an answer on June 9, 2026 at 3:59 pm

    I’ve addressed this problem by killing the process if it takes an unusual amount of time to run.

    here is my code should it be helpful to someone.

    In the asp file

    'Run this programm that will kill pdf generation if it hangs-execute for more than 10seconds
    wshell.run "KillProcess.exe -p wkhtmltopdf -t 10000",0,FALSE 
    'Launch pdf generation with bwaitonreturn true 
    wshell.run wkhtmltopdf.exe  http://www.mypagehanging.com  c:\inetpub\wwwroot\myfile.pdf", 0, TRUE 
    
    'Stream the pdf ...
    

    Code source for the KillProcess.exe

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading;
    using System.Diagnostics;
    using CommandLine; //http://commandline.codeplex.com
    using CommandLine.Text; //http://commandline.codeplex.com
    
    namespace KillProcess
    {
        class Program
        {
            static void Main(string[] args)
            {
                var options = new Options();
                ICommandLineParser parser = new CommandLineParser();
    
                if (parser.ParseArguments(args, options))
                {
                    double maxWaitTime = options.time; //ms
                    string processName = options.process;
                    bool exit;
                    do
                    {
                        exit = true;
                        foreach (Process p in GetProcesses(processName))
                        {
                            exit = false;
                            try
                            {
                                if (p.StartTime.AddMilliseconds(maxWaitTime) < DateTime.Now)
                                {
                                    p.Kill();
                                    Console.WriteLine("Killed Process: {0} ID: {1} started at {2} after {3}ms of execution time", p.ProcessName, p.Id, p.StartTime, options.time);
                                }
                            }
                            catch (Exception e)
                            {
                                Console.WriteLine(e.Message);
                            }
                        }
                        Thread.Sleep(100);
                    } while (!exit);
                    return;
                }
                else
                {
                    Console.WriteLine(options.GetUsage());
                    return;
                }
            }
    
            static IEnumerable<Process> GetProcesses(string processName)
            {
                var processes = from p in Process.GetProcesses()
                                where p.ProcessName == processName
                                orderby p.ProcessName
                                select p;
                return processes;
            }
    
            class Options : CommandLineOptionsBase
            {
                [Option("p", "process", Required = true, HelpText = "Name of the process-es to kill after some execution time (Warning ! This will kill all the processes that match the name !)")]
                public string process { get; set; }
    
                [Option("t", "time", Required = true, HelpText = "Maximum execution time allowed for the process to run. If the process has run for more than this amount of time it will be killed")]
                public int time { get; set; }
    
                [HelpOption]
                public string GetUsage()
                {
                    return HelpText.AutoBuild(this, (HelpText current) => HelpText.DefaultParsingErrorsHandler(this, current));
                }
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got an ASP website running on IIS 7.0. The app pool is classic,
I'm trying to create a website in IIS using this code (from another site
I want to run the following jquery code on every page in my website.
I am developing a simple ASP.NET website that will run on the intranet on
I am using Visual Studio to compile and run my ASP.NET website. Now, one
How Many Times Does an ASP .NET Application Start? I want to run something
I have an ASP.NET website which is running currently on IIS. Now I want
The website is set up locally on my IIS 5.1 on xp. Application protection
Solved using this post: Can you convert an ASP.NET MVC Application to a Web
I have a windows 2003 / IIS 6.5 machine running a classic ASP site.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.