Error: The operation has timed out


I am getting error converting HTML to PDF. My report takes more time to generate since it has many DB calls. Can you please give solution to generate the report.

Thanks In advance. PFB the error:-

Server Error in '/AsposeFinal' Application.

The operation has timed out

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.Net.WebException: The operation has timed out

Source Error:

Line 47:         Pdf pdf = new Pdf();
Line 48:         //Give the file path
Line 49:         pdf.BindHTMLFromUrl("http://localhost:1631/SFP/Reports/ABC.aspx");
Line 50:         //Give the file path to save
Line 51:         pdf.Save("C:/Inetpub/wwwroot/AsposeFinal/HTMLtoPDF.pdf");

Source File: c:\Inetpub\wwwroot\AsposeFinal\Default.aspx.cs Line: 49

Stack Trace:

[WebException: The operation has timed out]
   System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request) +287
   System.Net.WebClient.DownloadData(Uri address) +106
   System.Net.WebClient.DownloadData(String address) +29
   Aspose.Pdf.Pdf.BindHTMLFromUrl(String url) +272
   _Default.Button1_Click(Object sender, EventArgs e) in c:\Inetpub\wwwroot\AsposeFinal\Default.aspx.cs:49
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565


Thanks for considering Aspose.

Pdf class in Aspose.Pdf has a static property which can be used to set the length of time until the request times out for the Pdf document. Please try using TimeOutOfFileWebRequest to specify the timeout value. For more information please visit Pdf Members.