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

Rest Service - invalid routes

2 Answers 423 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Byron
Top achievements
Rank 1
Iron
Byron asked on 06 Apr 2021, 09:01 AM

I follow this post to setup report designer: https://docs.telerik.com/reporting/web-report-designer-setup-in-dot-net-framework
- Create a WebApi project.

- Add references to Telerik.Reporting.dll, Telerik.Reporting.Services.WebApi.dll, Telerik.WebReportDesigner.Services.dll (they are in C:\Program Files (x86)\Progress\Telerik Reporting R1 2021\Bin)

- Register routes in Global.asax

- Create controller that inherit ReportDesignerControllerBase

- Create view to display report designer

The error I got is the REST service have invalid routes. So when the view request for api/reportdesigner/resources/js/telerikReportViewer it return 404 error.

When I go to Help section of the WebApi project, I see the route table for the report controller is like this (see attachment)

Do anyone know why does this happen and how I can fix?

Thanks in advance!

2 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 09 Apr 2021, 08:11 AM

Hi Byron,

Without knowing the exact settings of the project I cannot be sure what exactly is causing the issue. It sounds like you have done all the steps, perhaps there is an invalid reference to the designer's js file?

The reason for this could also be a mismatch in the versions in some of the Telerik Reporting references. All Telerik Reporting references, assemblies, templates, etc. should match in version, please check whether that is the case.

If even that doesn't resolve the issue, you may install the Fiddler Jam extension then generate a log and share it with us. You may also send us a runnable project demonstrating the issue or the file on which the report viewer is located in. You may also send us the project and we will inspect it locally.

I have also attached a sample project that you can use as a reference, please check it out.

I look forward to receiving an update from you.

Regards,
Dimitar
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Byron
Top achievements
Rank 1
Iron
commented on 24 Apr 2021, 11:37 AM

Hi Dimitar,

Please see my code below. This is a Web API project.

https://app.box.com/s/ugs0vxzh2hkykmh2bsgsihkwdv7gryy4

Thanks

Byron
Top achievements
Rank 1
Iron
commented on 28 Apr 2021, 05:10 AM

@dimitar, do you find any problem with my code?
0
Dimitar
Telerik team
answered on 28 Apr 2021, 02:54 PM | edited on 29 Apr 2021, 06:42 AM

Hi Byron,

Thank you for the provided project. However, upon trying to start the project, I got the error message described in the following StackOverflow thread - Could not find a part of the path … bin\roslyn\csc.exe. I applied the first suggested fix in order to continue inspecting the project. Let me go over my findings below.

Investigation

First, I added forward slashes at a couple of places in the Index.cshtml file in order for the routes to be correct:

   <script src="/api/reportdesigner/resources/js/telerikReportViewer/"></script>
    <script src="/api/reportdesigner/designerresources/js/webReportDesigner/"></script>

    <script type="text/javascript">
        $(document).ready(function () {
            $("#webReportDesigner").telerik_WebReportDesigner({
                persistSession: false,
                toolboxArea: {
                    layout: "list"
                },
                serviceUrl: "/api/reportdesigner/",
                report: "Barcodes Report.trdp"
            }).data("telerik_WebDesigner");
        });
    </script>

Additionally, I had to comment out one of the lines in the Global.asax.cs file:

           Telerik.Reporting.Services.WebApi.ReportsControllerConfiguration.RegisterRoutes(GlobalConfiguration.Configuration);
            Telerik.WebReportDesigner.Services.WebApi.ReportDesignerControllerConfiguration.RegisterRoutes(GlobalConfiguration.Configuration);


            AreaRegistration.RegisterAllAreas();
            //GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

Finally, I see that you are trying to open the ReportBook.trbp in the Web Designer, however, our Web Report Designer doesn't support ReportBooks yet. I hope that you understand the designer is in active development and support for this is in our plans. 

Please let me know if you have any other questions or need further assistance. Thank you.

P.S. I migrated your answer and the comment to it as comments to my first answer.

Regards,
Dimitar
Progress Telerik

Тhe web is about to get a bit better! 

The Progress Hack-For-Good Challenge has started. Learn how to enter and make the web a worthier place: https://progress-worthyweb.devpost.com.

Byron
Top achievements
Rank 1
Iron
commented on 07 May 2021, 03:01 AM

Hi Dimitar,
Thanks for your investigation.
Can you explain why we need to comment out the line in Global.asax.cs? I need it because I'm running WebAPI.
Do you mean Telerik Reporting does not support Web API project, only support MVC project?
Dimitar
Telerik team
commented on 07 May 2021, 12:53 PM

It does not only support MVC, you can also create a reporting REST Web API. You may check the How to Add Telerik Reporting REST Web API to Web Application article.

The problem with the GlobalConfiguration.Configure(WebApiConfig.Register) is that if you want to use it, you must register the reports and report designer APIs in the WebApiConfig.Register method.

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

 

Dimitar
Telerik team
commented on 07 May 2021, 01:27 PM

I forgot to mention it in my last comment, but you may also need to add a RoutePrefix attribute to the report designer controller:

 [RoutePrefix("api/reportdesigner")]

Tags
General Discussions
Asked by
Byron
Top achievements
Rank 1
Iron
Answers by
Dimitar
Telerik team
Share this question
or