Reputation: 1054
Sorry experts for the title, I could not think of a better way.
The code below receives as many as 20 links, then using a component, converts those 20 links into documents and stores these documents into one adobe pdf file.
It works if you pass along less than 10. Anything above, breaks the app.
It turns out that the reason code is breaking is because it is taking too long to run.
Is there a way in asp.net (c# or vb.net) to configure the app to run longer without breaking?
Is this done on iis side?
If yes, can someone please point me in the right direction?
The one thing I know is iis metabase to set it to accept larger sizes but I am not sure what to do with the code below to ensure app doesn't break when taking too long to run.
using System;
using System.Collections.Generic;
using System.Text;
using EO.Pdf;
using System.Collections.Specialized;
using EO.Web;
partial class getRecs : System.Web.UI.Page
{
private void // ERROR: Handles clauses are not supported in C#
Page_Load(object sender, System.EventArgs e)
{
if (!Page.IsPostBack) {
string linksList = Request.QueryString("pid");
string[] AllLinks = linksList.Split(",");
//Create a PdfDocument object
PdfDocument doc = new PdfDocument();
string links = null;
foreach ( links in AllLinks) {
HtmlToPdf.ConvertUrl(url, doc);
}
doc.Save(Response.OutputStream);
}
}
}
Thanks for your help.
Upvotes: 0
Views: 2586
Reputation: 63956
It seems that you are having issues with Request timeouts since the process is taking too long to respond to the client with the PDfs generated. You can increase the Request timeout setting in the Web.config:
<configuration>
<system.web>
<httpRuntime
executionTimeout="1000"/>
</system.web>
</configuration>
The executionTimeout is set in seconds. Adjust according to your needs. This only applies if the debug
flag is set to false
in the compilation element.
Link to MSDN documentation.
Upvotes: 1