This project is read-only.

Does Render2 have a timeout value

Jul 14, 2010 at 6:36 PM

On our production system, we have reports that are failing.   If these reports take more then about 30 secs to render, the response header is returning with HTTP/1.1 500 Internal Error and the connection is set to 'close'.

Is there a 'timeout' variable/value we can change?


Jul 14, 2010 at 7:13 PM

You can take a look at You should find the instructions on how to setup timeouts for reports and datasets and you can avoid getting Internal Server error on the SOAP calls

Hope this helps



Jul 14, 2010 at 10:28 PM
Edited Jul 15, 2010 at 12:09 AM

Thanks for the advice.  My review of the sample code and stepping thru it, I can see I am doing the exact same thing.  So I was able to narrow down the problem to the exact area.   In the example code, the resultant report is being saved to the local drive.  What I am trying to do is, as in the sample code in the documentation provided with the SDK, I am trying to send the resultant data to direct download.  It is something in my HTTP Header info that is causing the problem.  Below is what I have.  Is the MIME type I have for Excel wrong?

header("Content-Type: application/");

header("Content-Disposition: attachment; filename=\"".$reportName.".xls\"");

header("Content-length: ".(string)(strlen($result)));

header("Expires: ".gmdate("D, d M Y H:i:s", mktime(date("H")+2,

header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");

date("i"), date("s"), date("m"), date("d"), date("Y")))." GMT");

header("cache-control: max-age=1");

echo $result;

Jul 14, 2010 at 11:50 PM

The MIME type seems to be correct, this is what I got by tracing an export in Excel format from SSRS

HTTP/1.1 200 OK
Cache-Control: private
Transfer-Encoding: chunked
Content-Type: application/
Expires: Wed, 14 Jul 2010 22:41:43 GMT
Server: Microsoft-HTTPAPI/2.0
X-AspNet-Version: 2.0.50727
Content-Disposition: attachment; filename="Company Sales 2008.xls"
Date: Wed, 14 Jul 2010 22:42:44 GMT

Could it be something else? can you check the file on the server to make sure it is a valid Excel file? could the file on disk be locked?

I'll add donwload to the getreports sample app and let you know if I find any problem.


Jul 15, 2010 at 12:20 AM

In my function, after I render the Excel file, I am saving it directly to disk as in the example code "download.php", and immediately after I call us the same "$results" object and I execute the HTTP Header code above.  What happens is that the file that was saved to disk opens as expected, an excel document displaying my report.  When I click the Open button on the "File Download" dialog box, it opens in excel completely unintelligible.

conclusion:  The $results from calling Render2 can be used to create a correct excel file when saved to disk using fopen\fwrite, but fails when trying to do a direct download via HTTP Headers


Jul 15, 2010 at 5:17 AM

Hi Larry,


Can you try with the following:

define("UID", "user name");
define("PASWD", "password ");
define("SERVICE_URL", "http://localhost/ReportServer_SQLEXPRESS/");
define("REPORT", "Path to report to be downloaded");
define("FILE_NAME", "File Name to be shown while showing Save Dialog box ex: result.xls");

            $rs = new SSRSReport(new Credentials(UID, PASWD),
      $executionInfo = $rs->LoadReport2(REPORT, NULL);
            $renderAsEXCEL = new RenderAsEXCEL();        
            $result_excel = $rs->Render2($renderAsEXCEL,
            header('Content-Description: File Transfer');
            header('Content-Type: application/octet-stream');
            header('Content-Disposition: attachment; filename='. FILE_NAME);
            header('Content-Transfer-Encoding: binary');
            header('Expires: 0');
            header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
            header('Pragma: public');
            header('Content-Length: ' . strlen($result_excel));
            echo $result_excel;
Let me know if it works
Jul 15, 2010 at 4:09 PM


I'm very sorry for wasting your time.  I discovered the problem last night.  white space!

called ob_clean() before my header() calls and it works like a charm. 

Thanks for your help

(red in the face) Larry

Jul 15, 2010 at 4:24 PM

For timeout problem, added the following to beginning of my code when rendering PDF

<font size="2">


</font>'max_execution_time', 300);