This is a migrated thread and some comments may be shown as answers.

"Missing report name" using UriReportSource

2 Answers 285 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Hank
Top achievements
Rank 1
Hank asked on 19 Feb 2018, 09:12 PM

I've developed some .trdp reports with the Report Designer R1 2018 standalone app and I'm trying to display them using an MVC view and Telerik Reporting v 12.0.18.125.  I had it working for about an hour last week, but since then I keep running into a 400 Bad Request error with the message "Report name missing".

I added the View and required REST API and everything else by using the Add->New Item->Telerik MVC Report Viewer View R1 2018 template.  The ReportsController is unchanged from the default that was added:

public class ReportsController : ReportsControllerBase
{
    static ReportServiceConfiguration configurationInstance;
 
    static ReportsController()
    {
        var appPath = HttpContext.Current.Server.MapPath("~/");
        var reportsPath = Path.Combine(appPath, "Reports");
 
 
        var resolver = new ReportFileResolver(reportsPath)
            .AddFallbackResolver(new ReportTypeResolver());
 
        configurationInstance = new ReportServiceConfiguration
        {
            HostAppId = "Html5App",
            Storage = new FileStorage(),
            ReportResolver = resolver,
        };
    }
 
    public ReportsController()
    {
        this.ReportServiceConfiguration = configurationInstance;
    }
}

 

Likewise, the View is the default that was added (renamed to TestReport.cshtml):

@using Telerik.Reporting
@using Telerik.ReportViewer.Mvc
@{
    Layout = null;
}
<!DOCTYPE html>
<head>
    <title>Telerik MVC HTML5 Report Viewer</title>
 
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
 
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
 
    <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
 
 
    <!--kendo.all.min.js can be used as well instead of the following custom Kendo UI subset-->
    <script src="@Url.Content("~/ReportViewer/js/telerikReportViewer.kendo-12.0.18.125.min.js")"></script>
 
    <style>
        #reportViewer1 {
            position: relative;
            width: 1300px;
            height: 900px;
            font-family: Verdana, Arial;
        }
    </style>
 
    <script src="@Url.Content("~/ReportViewer/js/telerikReportViewer-12.0.18.125.min.js")"></script>
 
</head>
<body>
 
@(Html.TelerikReporting().ReportViewer()
        .Id("reportViewer1")
        .ServiceUrl(Url.Content("~/api/reports"))
        .ReportSource(new UriReportSource() { Uri = "TestReport.trdp" })
        .ViewMode(ViewMode.Interactive)
        .ScaleMode(ScaleMode.Specific)
        .Scale(1.0)
        .PersistSession(false)
        .PrintMode(PrintMode.AutoSelect)
        .EnableAccessibility(false)
)
 
</body>
</html>

 

The following line was added to Global.asax.cs by the wizard:

Telerik.Reporting.Services.WebApi.ReportsControllerConfiguration.RegisterRoutes(System.Web.Http.GlobalConfiguration.Configuration);

 

There is a Reports folder containing the file TestReport.trdp, as well as a ReportViewer/js folder containing two telerikReportViewer*.js files.  There is a TestReport action in my Test controller that simply returns View().  I am not aware of any changes I've made to the defaults made by the wizard (e.g. no custom report resolver).

When I hit that view and look at the Network traffic in developer tools, I can see that it successfully makes a request to http://localhost:12345/api/reports/clients and receives a response, so I believe the REST service is running.  However, when it tries to call http://localhost:12345/api/reports/clients/115238-abc3/parameters with request body {parameterValues:{}, report:"TestReport.trdp"}, it always responds with {"message":"Missing report name"}, regardless of whether the filename in the Uri is one I know to be in the Reports folder.

I'm able to render and export the report as a PDF by putting the following in an Action, so I believe that a) the report can be found and read and b) it is not corrupt or otherwise has errors:

ReportProcessor rp = new ReportProcessor();
Hashtable deviceInfo = new Hashtable();
UriReportSource reportSource = new UriReportSource();
reportSource.Uri = "Reports/TestReport.trdp";
RenderingResult result = rp.RenderReport("PDF", reportSource, deviceInfo);
 
using (FileStream fs = new FileStream(outputPath, FileMode.Create)) {
    fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length);
}

 

I also set up a very small MVC project to try to debug and successfully got reports to render in that.  When I try to resolve a report that doesn't exist (e.g. zzzTestReport.trdp) using this project, it returns the message "Report 'zzzTestReport.trdp' cannot be resolved.", so I believe the "Missing report name" error has nothing to do with not being able to find the report.

I've tried importing the .trdp file to create a report class and rendering using a TypeReportSource, and I've even tried removing any trace of the report viewer from the project and re-adding it.  No matter what I do, I keep getting the same "Missing report name" error.  I'm guessing there's a configuration error or something hidden deep in my project, but I can't for the life of me find where (even when comparing to a working project), and the error message itself isn't providing any guidance.  If anybody can offer any insights on how to get reports to render (or really just to have the api return something useful for the parameters call), I would greatly appreciate it.

Thanks!

 

2 Answers, 1 is accepted

Sort by
0
Nathan
Top achievements
Rank 1
answered on 23 Jul 2018, 08:19 PM
Was this issue ever resolved?  I am having the same issue.  My project works fine locally but when I publish to our server (Windows 2008R2) I am getting this 400 Bad Request with body {"message":"Missing report name"}.  It's very strange because it is getting the client id then fails on the parameter request.
0
Hank
Top achievements
Rank 1
answered on 24 Jul 2018, 08:36 PM

Oh boy, it's been a while, let's see if I can remember...

It was resolved, and it ended up being something silly.  I believe at the time, we were updating NuGet package lists and something got messed up between updating packages and checking in, so not all assemblies were being loaded correctly (in particular, I think Newtonsoft.Json).  I think we had different versions of the same assembly in our web.config, or something like that.  If it's compiling and working locally but not on the server, I would check that all the proper DLLs are there and that the web.config doesn't have any problems.

Tags
General Discussions
Asked by
Hank
Top achievements
Rank 1
Answers by
Nathan
Top achievements
Rank 1
Hank
Top achievements
Rank 1
Share this question
or