我在CRM工作流程中实施serverReport。(不是在线版本)
我设置了工作流程非沙箱,我试图在C#Webservice中实现一个版本的ServerReport。
这是代码:(最后一行是抛出异常的那一行)
sr.ReportServerUrl = new Uri(reportServerBaseURL);
sr.ReportPath = reportDir + reportName;
// Credential to connect with CRM
IReportServerCredentials irsc = new CustomReportCredentials(username, password, "");
sr.ReportServerCredentials = irsc;
if (paramList != null && paramList.Count > 0)
{
bool isTimeout = true;
for (int i = 0; i < 6; i++)
{
try
{
sr.Timeout = 5000;
sr.Refresh();
sr.SetParameters(paramList);
isTimeout = false;
break;
}
catch (Exception ex)
{
}
}
if (isTimeout)
{
string message = "Report timeout";
throw new Exception(message);
}
}
sr.Timeout = 5000;
sr.Refresh();
string renderingString = null;
switch (renderingMethod)
{
case RSRenderingMethods.PDF:
renderingString = "PDF";
break;
case RSRenderingMethods.EXCEL:
renderingString = "EXCEL";
break;
case RSRenderingMethods.PNG:
case RSRenderingMethods.JPEG:
case RSRenderingMethods.GIF:
case RSRenderingMethods.TIFF:
renderingString = "IMAGE";
break;
}
//I'm reaching this point without problems, the format I'm using is PDF
byte[] bytes = bytes = sr.Render(renderingString, null); //this line is throwing the exception
使用WebService,我对报告呈现没有任何问题,而且我不知道为什么这次我会使用它们。
报告大约30-40行,所以它根本不大。可能问题出在我正在做的事情上吗?