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 8684025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:11:40+00:00 2026-06-12T22:11:40+00:00

I use Linq2Sql to retrieve a list of ID’s that I use to launch

  • 0

I use Linq2Sql to retrieve a list of ID’s that I use to launch a SSRS report export wia SSRS web service.
The query retrieves about 200 items and I use a foreach loop to loop through them.

I pass the List object containing the ID’s to a method executed in a new thread.

The SSRS report generation is quite long, so sometimes when the server goes slower due to work load, the overall execution execeedes the 20 minutes and my threads ends, with no exception.

Is there a timeout setting in Linq2Sql DataContext that matches this use case, after which my results become unavailable and the foreach loop ends?

Update 1 (the code):

List<String> list = dc.ListaIDs().ToList<String>();
int count = 0;
foreach (var item in list)
{
    string FileName = "report_" + (++count).ToString() + ".pdf";
    LoggerUtility.Instance.log.Debug(String.Format("export => " + FileName));
    try
    {
        switch (ReportFormat)
        {
            case "PDF":
                risultato = ReportServiceImpl.WSReport("PDF", item);
                System.IO.File.WriteAllBytes(FileName, risultato.PDFResult);
                break;
            default:
                LoggerUtility.Instance.log.Warn("no format");
                break;
        }
    }
    catch (Exception ex)
    {
        LoggerUtility.Instance.log.Warn("error exporting => " + FileName, ex);
    }
}

Update 2:

The rs object (of a custom ReportService class I made to separate report WS calls) is not in the same scope of the thread; it’s declared and instantiated outside the method launched as a thread and the class containing the method and the rs declaration is an MVC 3 controller.

In the ReportService class every call instantiates a new ReportExecutionService (previously obtained by a web reference to ReportExecution2005.asmx).

Update 3 (the WS call code and a little update in the first part of code):

I refactored the code to have a static call to my ReportServiceImpl‘s method and applying what’s told in @JamieSee’s response that may exclude timeout in Linq2Sql.
This is the ReportServiceImpl.WSReport actual implementation; after 20 minutes it stops without exceptions at result = service.Render(...):

public static ReportResult WSReport(String format, string id)
{
    ReportResult _return = new ReportResult();
    ReportExecution.ReportExecutionService service = null;
    try
    {
        byte[] result;
        service = new ReportExecution.ReportExecutionService();

        String reportPath = @"/myReport";
        string historyID = null;

        service.UseDefaultCredentials = true;

        //load report
        ExecutionInfo execInfo = new ExecutionInfo();
        ExecutionHeader execHeader = new ExecutionHeader();

        service.ExecutionHeaderValue = execHeader;
        execInfo = service.LoadReport(reportPath, historyID);

        //set execution parameter
        ParameterValue[] parameters = new ParameterValue[1];
        parameters[0] = new ParameterValue() { Name = "id", Value = id };
        service.SetExecutionParameters(parameters, "it-IT");

        String SessionId = service.ExecutionHeaderValue.ExecutionID;

        //render report actually
        String deviceInfo = "";
        String extension;
        String mimetype;
        String encoding;
        GestioneVIP_Services.ReportExecution.Warning[] warnings;
        string[] streams;
        result = service.Render(format, deviceInfo, out extension, out mimetype, out encoding, out warnings, out streams);
        switch (format)
        {
            case Constants.EXCEL_FORMAT:
                _return.XLSResult = result;
                break;
            case Constants.PDF_FORMAT:
                _return.PDFResult = result;
                break;
            case Constants.HTML_FORMAT:
                _return.HTMLResult = result;
                break;
        }
    }
    catch (SoapException ex)
    {
        LoggerUtility.Instance.log.Error(String.Format("{0}/n{1}", ex.Message, ex.StackTrace));
    }
    catch (Exception ex)
    {
        LoggerUtility.Instance.log.Error(String.Format("{0}/n{1}", ex.Message, ex.StackTrace));
    }
    finally
    {
        if (service != null)
        {
            service.Dispose();
        }
    }
    return _return;
}
  • 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-12T22:11:42+00:00Added an answer on June 12, 2026 at 10:11 pm

    Testing with the multiple thread configuration mentioned in a comment above and going deeper into this issue, I found the correct answer to it, so I’m reporting it here for completeness.

    The reason for this subtle timeout, resides in the Idle Time-out configuration in the Process Model section of the Advanced Settings of the Application Pool.

    It’s default value is 20 minutes.

    For some reason that I yet don’t understand, a process initiated from the web layer that launches some threads, if there’s no web layer activity is treated as Idle and then stopped. It can be seen even following the behaviour of the w3wp.exe process in the Processes tab in Task Manager.
    Any threads, queued in a ThreadPool or launched directly by this process will end with the process.

    At the end I can say it’s not Linq2Sql related and not SRSS web services related, but more IIS process model related.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to use Linq2Sql to return all rows that contain values from
I'm working on a WP7 mango App that makes use of Linq2SQL for data
In a bigger project we decided to use Linq2Sql in the web-services (WCF). We
I'm in the process of converting a LINQ2SQL project to use NHibernate. One query
Does LINQ2SQL make use of table indexes when executing a query?
I notice a lot of the examples for ASP.NET use Linq2Sql as the datasource.
use Modern::Perl; use Algorithm::Permute; use List::AllUtils qw/uniq/; find_perms(1151); sub find_perms { my ($value) =
I use linq2sql and m_DateContext.Dates class for table ID | ParentID | Datestamp ---|----------|----------
Is it possible to use LINQ2SQL as MVC model and bind? - Since L2S
I am slowly porting over an app from MySQL to use Linq2Sql - but

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.