RDLC报表(Microsoft reportViewer)部署到服务器后未呈现
当从机器内部访问时,我的rdlc报告在开发机器(部署后)中正确呈现和工作,部署后(从机器内部访问时)它也在生产服务器中工作。但是,当我试图从客户机访问报表时,它并没有呈现web应用程序的其他组件是否正常工作。
我得到的错误是:
谷歌浏览器:
未能加载pdf文档
互联网爆炸者:
文件已损坏,无法修复
如何修复此错误?
我的控制器代码是:
Function GenerateReportS(value As String, lcvalue As String) As ActionResult
Dim assetlist As List(Of usp_standardreportquery_Result)
If value IsNot Nothing Or lcvalue IsNot Nothing Then
assetlist = db.usp_standardreportquery.Where(Function(r) If(value IsNot Nothing, r.AssignLocation = value, True) And
If(lcvalue IsNot Nothing, r.LocationCategory = lcvalue, True)).ToList
Else
assetlist = db.usp_standardreportquery.ToList
End If
Dim warnings As Warning()
Dim mimeType As String
Dim streamids As String()
Dim encoding As String
Dim filenameExtension As String
Dim viewer = New ReportViewer()
viewer.LocalReport.ReportPath = "Views\Reports\StandardReport.rdlc"
Dim dataset As Microsoft.Reporting.WebForms.ReportDataSource = New Microsoft.Reporting.WebForms.ReportDataSource("standardreportds", assetlist)
viewer.LocalReport.DataSources.Add(dataset)
Dim params(2) As ReportParameter
params(0) = New ReportParameter("SearchBy", "Location", False)
params(1) = New ReportParameter("value", value, False)
params(2) = New ReportParameter("Category", lcvalue, False)
viewer.LocalReport.SetParameters(params)
dataset.Value = assetlist
viewer.LocalReport.Refresh()
Dim bytes = viewer.LocalReport.Render("PDF", Nothing, mimeType, encoding, filenameExtension, streamids,
warnings)
Return New FileContentResult(bytes, mimeType)
'Return File(bytes, mimeType, "_PackingSlip.pdf")
End Function
如何修复此错误?