秦皇岛老王 发表于 2020-5-26 10:23:27

ASP.NET MVC中JSVIEWER显示Report Not Found,哪里错了?

ASP.NET MVC中JSVIEWER显示Report Not Found,哪里错了?
报表放在http://www.****.com/WangzcSmartCampus/虚拟目录中,虚拟目录指向:E:\Test
报表位置:E:\WEB\Test\Reports\RdlReport1.rdlx
Starttup.cs:
using GrapeCity.ActiveReports.Aspnet.Viewer;
using Microsoft.Owin;
using Owin;
using System;
using System.IO;
using System.Web.Routing;


namespace WangzcSmartCampusWeb
{
    public partial class Startup
    {
      public static string EmbeddedReportsPrefix = "WangzcSmartCampus.Reports";
      public void Configuration(IAppBuilder app)
      {
            app.UseReporting(settings =>
            {
                settings.UseFileStore(new DirectoryInfo(String.Format(@"{0}.\Reports", System.Web.HttpRuntime.AppDomainAppPath)));
            });
            RouteTable.Routes.RouteExistingFiles = true;
      }
    }
}

页面:Home/Index
<div class="border-b rounded shadow-sm w-100" style="height:300px" id="viewerContainer">
</div>

    <script type="text/javascript">
      var viewer = GrapeCity.ActiveReports.JSViewer.create({
            element: '#viewerContainer',
            reportID: 'RdlReport1.rdlx', // the id of the report to display
            availableExports: ['Xml', 'Pdf', 'Excel'],
            reportService: {
                url: '/WangzcSmartCampus/Reports/'
            }
            // other properties
      });
    </script>

浏览器打开后报错:
Report not found: RdlReport1.rdlx
CONSOLE提示:
jsViewer.min.js:81 GET http://www.****.com/WangzcSmartCampus/Reports/reports/RdlReport1.rdlx/info 404 (Not Found)
请问如何解决?

KearneyKang 发表于 2020-5-26 11:28:03

报表没有找到,根据错误提示应该是报表路径配置哪里有问题,然后没有找到对应的报表路径导致的。,你看看你的报表的路径看看是否正确
页: [1]
查看完整版本: ASP.NET MVC中JSVIEWER显示Report Not Found,哪里错了?