0

I have to build report using SPLongOperation to avoid timeout exception. It doesn't work when I try to push file to response:

HttpContext.Current.Response.BufferOutput = true;
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.ClearHeaders();
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=Report.xls");
HttpContext.Current.Response.ContentType = "application/octet-stream";
HttpContext.Current.Response.BinaryWrite(byteArray);
HttpContext.Current.Response.End();

How can i do that?

  • At what point you are getting Time out exception? – Aanchal Jun 16 '14 at 8:32
  • Report building can take a long time because of processing big lists – Dmitry Zimelev Jun 16 '14 at 8:38
0

SharePoint requests would timeout after 6 minutes and these executionTimeout settings are set in the web.config file located at the \Template\Layouts directory.

<system.web>
    <compilation batch="false" batchTimeout="600" maxBatchSize="10000" maxBatchGeneratedFileSize="10000" />
    <customErrors mode="On" />
    <httpRuntime executionTimeout="360" />
    <globalization fileEncoding="utf-8" />
</system.web>

If you need to run a really long procedure (e.g., lasting for 1 hour) you need to use other ways, timer jobs, for instance

Also you can try : IIS -> Application Pool -> Advanced Settings -> Process Model -> Shutdown Time Limit (seconds)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.