繁体   English   中英

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

[英]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>

题:

  1. 为什么会这样呢?
  2. 我该如何解决?

试试这个: 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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM