Skip to content

Commit

Permalink
Added new kb article resolve-reporting-rest-service-access-issues (#1422
Browse files Browse the repository at this point in the history
)

* Added new kb article resolve-reporting-rest-service-access-issues

* Update resolve-reporting-rest-service-access-issues.md

* Update resolve-reporting-rest-service-access-issues.md

* Update resolve-reporting-rest-service-access-issues.md

* Update resolve-reporting-rest-service-access-issues.md

---------

Co-authored-by: KB Bot <[email protected]>
Co-authored-by: Dimitar Nikolov <[email protected]>
Co-authored-by: Todor Arabadzhiev <[email protected]>
  • Loading branch information
4 people authored Jun 20, 2024
1 parent 2629d6d commit da143c9
Showing 1 changed file with 69 additions and 0 deletions.
69 changes: 69 additions & 0 deletions knowledge-base/resolve-reporting-rest-service-access-issues.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
title: Multiple actions were found that match the request
description: "Learn how to fix the error about multiple actions matching the same request caused by the greedy routes of the Reporting service."
type: troubleshooting
page_title: Multiple actions were found that match the request
slug: resolve-reporting-rest-service-access-issues
tags: telerik, reporting, rest, service, access, error, upgrade, cors
res_type: kb
ticketid: 1655171
---

## Environment

| Product | Progress® Telerik® Reporting |
| --- | --- |
| Project Type | ASP.NET Framework |

## Description

After implementing the [Reporting REST Service]({%slug telerikreporting/using-reports-in-applications/host-the-report-engine-remotely/telerik-reporting-rest-services/overview%}) in an ASP.NET Framework application - [Telerik Reporting REST Service ASP.NET Web API Implementation]({%slug telerikreporting/using-reports-in-applications/host-the-report-engine-remotely/telerik-reporting-rest-services/asp.net-web-api-implementation/overview%}), when the application starts, the error page is displayed with details about a problem with the [ReportsController](/api/telerik.reporting.services.webapi.reportscontrollerbase).

## Error Message

````HTML
<Error>
<Message>An error has occurred.</Message>
<ExceptionMessage>Multiple actions were found that match the request: Formats on type Controllers.ReportsController GetClientsSessionTimeoutSeconds on type Controllers.ReportsController Version on type Controllers.ReportsController</ExceptionMessage>
<ExceptionType>System.InvalidOperationException</ExceptionType>
<StackTrace> at System.Web.Http.Controllers.ApiControllerActionSelector.ActionSelectorCacheItem.SelectAction(HttpControllerContext controllerContext) at System.Web.Http.ApiController.ExecuteAsync(HttpControllerContext controllerContext, CancellationToken cancellationToken) at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()</StackTrace>
</Error>
````

## Cause

The issue is likely caused by a greedy route in the route configuration, which interferes with the proper registration and functioning of the Reporting REST service routes. This can occur when the reporting routes are not prioritized in the route registration order.

## Solution

### Solution 1

To resolve this issue, ensure that the reporting routes are registered before the default ones. This action gives them priority and prevents them from being overridden by other more general routes. Use the following steps:

1. Register the reporting routes before any default or other custom routes in your Web API configuration:

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

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


1. Verify that the [`routeTemplate`](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.routing.template.routetemplate?view=aspnetcore-8.0) includes the `{action}` part. Omitting this can cause issues due to multiple actions matching the same route template.

### Solution 2

Change the first path segment included in the route template using the [ReportsControllerConfiguration.RegisterRoutes(HttpConfiguration, String)](/api/telerik.reporting.services.webapi.reportscontrollerconfiguration#Telerik_Reporting_Services_WebApi_ReportsControllerConfiguration_RegisterRoutes_System_Web_Http_HttpConfiguration_System_String_) method overload.

For example, "api" is the default literal path segment in the "api/{controller}" route template. Use this overload and pass a unique path segment (e.g. "reportingapi") to avoid collisions with other Web API services - `Telerik.Reporting.Services.WebApi.ReportsControllerConfiguration.RegisterRoutes(config, "reportingapi");`


## See Also

- [How to change the registered by default Telerik Reporting REST Web API routes]({%slug how-to-change-reporting-rest-web-api-routes-registered-by-default%})
- [Multiple actions were found that match the request in Web API - Stack Overflow](https://stackoverflow.com/questions/14534167/multiple-actions-were-found-that-match-the-request-in-web-api)
- [Hosting Telerik Reporting REST Service in ASP.NET]({%slug telerikreporting/using-reports-in-applications/host-the-report-engine-remotely/telerik-reporting-rest-services/asp.net-web-api-implementation/how-to-add-telerik-reporting-rest-web-api-to-web-application%})

0 comments on commit da143c9

Please sign in to comment.