[英]ReportViewer Not working correctly after site published
問題:
我們有一個asp.net reportviewer,它為.rdlc動態分配了一個數據集,在我的本地計算機上,它工作得很好,當我們發布到Web服務器並嘗試運行它時,會發生錯誤。
錯誤:
An error occurred during local report processing.
The report definition for report 'C:\Program Files (x86)\Acumatica ERP\WRIGHTACUMATICA\rErrorCompilation.rdlc' has not been specified
Could not find file 'C:\Program Files (x86)\Acumatica ERP\WRIGHTACUMATICA\rErrorCompilation.rdlc'.
附加信息:
錯誤中指定的目錄不在服務器上。 temp是要分配的數據集。
C#:
this.rvErrorCompilation.Reset();
this.rvErrorCompilation.LocalReport.ReportPath = Server.MapPath("~/rErrorCompilation.rdlc");
ReportDataSource rds = new ReportDataSource("dsErrorCompilation", temp);
this.rvErrorCompilation.LocalReport.DataSources.Clear();
this.rvErrorCompilation.LocalReport.DataSources.Add(rds);
this.rvErrorCompilation.DataBind();
this.rvErrorCompilation.LocalReport.Refresh();
Asp.Net:
<rsweb:ReportViewer ID="rvErrorCompilation" runat="server" Width="100%">
<LocalReport ReportPath="rErrorCompilation.rdlc">
<DataSources>
<rsweb:ReportDataSource />
</DataSources>
</LocalReport>
</rsweb:ReportViewer>
題:
試試這個: ReportPath="~/rErrorCompilation.rdlc"
<rsweb:ReportViewer ID="rvErrorCompilation" runat="server" Width="100%">
<LocalReport ReportPath="~/rErrorCompilation.rdlc">
<DataSources>
<rsweb:ReportDataSource />
</DataSources>
</LocalReport>
</rsweb:ReportViewer>
即使已指定這樣做,Microsoft Visual Studio顯然也不會在發布時復制.rdlc文件,在將其手動移動到Web根目錄之后,它現在可以正常工作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.