Problem to update my old version of Telerik Report Viewer

0 Answers 377 Views
Report Viewer - HTML5 Report Viewer - MVC
Clovis
Top achievements
Rank 1
Clovis asked on 22 Jul 2022, 09:13 PM

 am trying to upgrade an ASP.Net MVC (.net framework 4.6.1) application from Telerik Reporting R1 2018 to R2 2022 and can't even get the viewer to display.  The error on screen says

Cannot access the Reporting REST service. (serviceUrl = '/api/reportsapi/'). Make sure the service address is correct and enable CORS if needed. (https://enable-cors.org)

When I open the browser developer tools I see the error has occurred on the call to api/reportsapi/version and the exception message is:

Multiple actions were found that match the request: System.Net.Http.HttpResponseMessage GetDocumentFormats() no tipo Telerik.Reporting.Services.WebApi.ReportsControllerBase System.Net.Http.HttpResponseMessage GetClientsSessionTimeoutSeconds() no tipo Telerik.Reporting.Services.WebApi.ReportsControllerBase System.Net.Http.HttpResponseMessage GetVersion() no tipo Telerik.Reporting.Services.WebApi.ReportsControllerBase</ExceptionMessage>

Any idea where to even begin looking?  The prior version worked flawlessly.  We do have a custom report resolver because we change the connection string based on the tenant ID of the logged in user, but I have upgraded that.

Neli
Telerik team
commented on 27 Jul 2022, 12:20 PM

Hi Clovis,

I am really sorry to hear that you are experiencing issues after the upgrade.

The problem most probably comes from a greedy route in the routes configuration. I suggest moving the registration of the reporting routes before the default ones, for example, like in the following code snippet:

Telerik.Reporting.Services.WebApi.ReportsControllerConfiguration.RegisterRoutes(config);

config.Routes.MapHttpRoute(
    name: "DefaultApi",
    routeTemplate: "api/{controller}/{action}/{id}",
    defaults: new { id = RouteParameter.Optional }
);

The reason is that this way the reporting route will be prioritized and won't be overridden by the greedy ones. If you don't expose other WEB API routes, you may simply delete the default ones.

This has fixed the issue for other clients who have experienced this error, and I hope it will solve it also for you. 

Please note that there is also a public feedback item that you can vote for in order to increase the priority of the issue - The ApiDefault route registered in ReportsControllerConfiguration.RegisterRoutes hides some routes registered after it.

Please, give this suggestion a try and let me know how it goes.

No answers yet. Maybe you can help?

Tags
Report Viewer - HTML5 Report Viewer - MVC
Asked by
Clovis
Top achievements
Rank 1
Share this question
or