First off, the error doesn't occur when running locally, only when I have it published to the web server (Server 2008 R2). The error message (first portion) that gets returned is:
首先,只有在我将其发布到Web服务器(Server 2008 R2)时,才会在本地运行时发生错误。返回的错误消息(第一部分)是:
MICROSOFT.REPORTING.WEBFORMS.LOCALPROCESSINGEXCEPTION: AN ERROR OCCURRED DURING LOCAL REPORT PROCESSING. ---> SYSTEM.NULLREFERENCEEXCEPTION: OBJECT REFERENCE NOT SET TO AN INSTANCE OF AN OBJECT. A MICROSOFT.REPORTINGSERVICES.RENDERING.HPBPROCESSING.TABLIX.UPDATETOPITEMKT(PAGEITEM TOPITEM, ROWINFO ROWINFO, PAGEDETAILCELL CURRCELL)
MICROSOFT.REPORTING.WEBFORMS.LOCALPROCESSINGEXCEPTION:在本地报告处理期间发生的错误。 ---> SYSTEM.NULLREFERENCEEXCEPTION:对象参考未设置为对象的实例。 MICROSOFT.REPORTINGSERVICES.RENDERING.HPBPROCESSING.TABLIX.UPDATETOPITEMKT(PAGEITEM TOPITEM,ROWINFO ROWINFO,PAGEDETAILCELL CURRCELL)
The code snippet that is rendering the report is in VB.Net...
呈现报告的代码片段在VB.Net中...
Dim report As LocalReport = New LocalReport()
report.DataSources.Clear()
report.ReportPath = "App_GlobalResources\MyReport.rdlc"
report.DataSources.Add(New ReportDataSource("MyDataSource", MyDataTable))
report.Refresh()
Dim byteReport As Byte() = New Byte() {}
'The next line is where it fails with the exception above.
byteReport = report.Render("pdf") 'Get bytes to use with memory stream
We do have other reports that work fine using the same code, but this report uses the Row Groups in the table to group data together with a heading...the ones that work do not use the row groups.
我们确实有其他报告可以使用相同的代码正常工作,但是此报告使用表中的行组将数据与标题组合在一起...那些有效的组不使用行组。
Again, this only happens when posted to the web server. I have found a couple links that seem to be similar (one below), but wanted to see if anyone had experienced this. ReportViewer export to PDF Null reference
同样,这仅在发布到Web服务器时发生。我发现了一些似乎相似的链接(下面有一个),但是想知道是否有人经历过这种情况。 ReportViewer导出为PDF Null引用
1 个解决方案
#1
1
I was able to find a fix that worked for me and resolved this issue, so hopefully it will help others that come across this question.
我能够找到一个对我有用的解决方案并解决了这个问题,所以希望它能帮助遇到这个问题的其他人。
We were developing in VS2010 when we created our first rdlc using MS ReportViewer 2010. We have since upgraded to VS2013 and .Net 4.5 and we never touched our existing rdlc because everything continued to work. When we created the new rdlc's, we targeted MS ReportViewer 2010 again, however the new reports that were using the table control and row groups to group data within the table would fail when they were deployed to a web server.
当我们使用MS ReportViewer 2010创建我们的第一个rdlc时,我们在VS2010中进行开发。我们已经升级到VS2013和.Net 4.5,我们从未触及现有的rdlc,因为一切都继续工作。当我们创建新的rdlc时,我们再次针对MS ReportViewer 2010,但是当将它们部署到Web服务器时,使用表控件和行组对表中的数据进行分组的新报表将会失败。
What I did was I installed the MS ReportViewer 2012 Runtime (if needed) so that I could reference the newer dll. I then installed it on the web server as well. Note: You might be prompted to install Microsoft® System CLR Types for Microsoft® SQL Server® 2012. You can find the x86/x64 downloads near the bottom of the Install Instructions.
我做的是安装了MS ReportViewer 2012 Runtime(如果需要),以便我可以引用更新的dll。然后我也将它安装在Web服务器上。注意:系统可能会提示您安装Microsoft®SystemCLR TypesforMicrosoft®SQLServer®2012。您可以在安装说明底部附近找到x86 / x64下载。
Once I re-published the updated website to the updated web server, everything worked without errors. I did notice that my formatting was a little different using 2012 than it was in 2010, but the changes required to resolve those differences were minimal.
一旦我将更新的网站重新发布到更新的Web服务器,一切都正常运行。我确实注意到我使用2012年的格式与2010年有所不同,但解决这些差异所需的更改很少。
#1
1
I was able to find a fix that worked for me and resolved this issue, so hopefully it will help others that come across this question.
我能够找到一个对我有用的解决方案并解决了这个问题,所以希望它能帮助遇到这个问题的其他人。
We were developing in VS2010 when we created our first rdlc using MS ReportViewer 2010. We have since upgraded to VS2013 and .Net 4.5 and we never touched our existing rdlc because everything continued to work. When we created the new rdlc's, we targeted MS ReportViewer 2010 again, however the new reports that were using the table control and row groups to group data within the table would fail when they were deployed to a web server.
当我们使用MS ReportViewer 2010创建我们的第一个rdlc时,我们在VS2010中进行开发。我们已经升级到VS2013和.Net 4.5,我们从未触及现有的rdlc,因为一切都继续工作。当我们创建新的rdlc时,我们再次针对MS ReportViewer 2010,但是当将它们部署到Web服务器时,使用表控件和行组对表中的数据进行分组的新报表将会失败。
What I did was I installed the MS ReportViewer 2012 Runtime (if needed) so that I could reference the newer dll. I then installed it on the web server as well. Note: You might be prompted to install Microsoft® System CLR Types for Microsoft® SQL Server® 2012. You can find the x86/x64 downloads near the bottom of the Install Instructions.
我做的是安装了MS ReportViewer 2012 Runtime(如果需要),以便我可以引用更新的dll。然后我也将它安装在Web服务器上。注意:系统可能会提示您安装Microsoft®SystemCLR TypesforMicrosoft®SQLServer®2012。您可以在安装说明底部附近找到x86 / x64下载。
Once I re-published the updated website to the updated web server, everything worked without errors. I did notice that my formatting was a little different using 2012 than it was in 2010, but the changes required to resolve those differences were minimal.
一旦我将更新的网站重新发布到更新的Web服务器,一切都正常运行。我确实注意到我使用2012年的格式与2010年有所不同,但解决这些差异所需的更改很少。