ReportViewer在网站发布后无法正常工作

问题描述 投票:0回答:2

问题:

我们有一个asp.net reportviewer,它动态地为.rdlc分配了一个数据集,在我的localmachine上它工作得非常好,当我们发布到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>

题:

  1. 为什么会这样?
  2. 我该如何解决?
c# asp.net acumatica
2个回答
0
投票

试试这个:ReportPath="~/rErrorCompilation.rdlc"

<rsweb:ReportViewer ID="rvErrorCompilation" runat="server" Width="100%">
        <LocalReport ReportPath="~/rErrorCompilation.rdlc">
        <DataSources>
            <rsweb:ReportDataSource />
        </DataSources>
    </LocalReport>
        </rsweb:ReportViewer>

0
投票

Microsoft Visual Studio显然没有在发布时复制.rdlc文件,即使它被指定这样做,在手动将其移动到Web根目录后,它现在可以正常工作。

© www.soinside.com 2019 - 2024. All rights reserved.