简体   繁体   中英

ReportViewer Not working correctly after site published

Problem:

We have a asp.net reportviewer that is dynamically assigned a dataset to the .rdlc, on my localmachine it works perfectly fine, when we publish to the webserver and attempt to run it an error occurs.

Error:

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'.

Additional Information:

The directory specified in the error is not on the server. temp is the dataset being assigned.

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>

Question:

  1. Why is this happening?
  2. How may I fix it?

Try this: 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根目录之后,它现在可以正常工作。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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