I'm facing some problem with the Render of some Reports during my SharePoint Timer Job. The same code running in a Console Application works correctly but in SharePoint Timer job stops working without generate any exception.
The code is the same in both cases:
private static byte[] InvokeReportingService(string reportPath, ParameterValue[] parametri)
{
byte[] ret = new byte[0];
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (var rs = new ReportExecution.ReportExecutionService())
{
rs.UseDefaultCredentials = true;
rs.Timeout = 300000;
string format = "Excel";
string historyID = null;
string devInfo = @"<DeviceInfo><Toolbar>False</Toolbar></DeviceInfo>";
string showHideToggle = null;
string encoding;
string mimeType;
string extension;
ReportExecution.Warning[] warnings = null;
ParameterValue[] reportHistoryParameters = null;
string[] streamIDs = null;
ExecutionInfo2 execInfo2 = new ExecutionInfo2();
var execHeader = new ExecutionHeader();
ServerInfoHeader svrinfoHeader;
execInfo2 = rs.LoadReport2(reportPath, historyID);
rs.SetExecutionParameters2(parametri, "it-IT");
String SessionId = execInfo2.ExecutionID.ToString();
ret = rs.Render(format, devInfo, out extension,
out mimeType, out encoding, out warnings,
out streamIDs);
// null, format, devInfo, out result, out extension, out mimeType, out encoding, out warnings, out streamID);
}
});
return ret;
}
SqlServer reporting Services works against a my SQL Server DB on which the Timer Job account has read access.
Does anybody has some idea of how to solve this problem?
Debugging I can see the program freeze after the "SetExcecutionParameter2" method..
Thank you very much!