HaBo
HaBo

Reputation: 14287

Configure Telerik Reporting with ASP.NET MVC

I am following this article on how to configure Telerik Reporting on ASP.NET MVC 5 and .NET 4.6.1 Using HTML5 ASP.NET MVC Report Viewer in a web application then Telerik Reporting REST Web API to Web Application

One thing I could not do in this is Register routes enter image description here

If I do it, I get following error. I think its conflicting with some other routes, not sure where it is... enter image description here enter image description here

I tried commenting out MVC routes registration, that also gives same error

//RouteConfig.RegisterRoutes(RouteTable.Routes);

A route named 'Resources' is already in the route collection. Route names must be unique. Parameter name: name

So without registering the route when I do POST call to the following URL I get good response. enter image description here

But If I try to verify the reports as per the documentation I get the following error enter image description here Any help is greatly appreciated.

Update


Route issue is fixed. removed a duplicate entry in WebApiConfig initialization

When access this URL http://localhost:[portnumber]/api/reports/formats Following error is still not resolved

{"message":"An error has occurred.","exceptionMessage":"The type initializer for 'Telerik.Reporting.Processing.RenderingExtensionManager' threw an exception.","exceptionType":"System.TypeInitializationException","stackTrace":" at Telerik.Reporting.Services.Engine.ReportEngine.ListRenderingExtensions()\r\n at Telerik.Reporting.Services.WebApi.ReportsControllerBase.GetDocumentFormats()\r\n at lambda_method(Closure , Object , Object[] )\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass6_2.b__2(Object instance, Object[] methodParameters)\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ApiControllerActionInvoker.d__1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ActionFilterResult.d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ExceptionFilterResult.d__6.MoveNext()"}

Upvotes: 1

Views: 1130

Answers (2)

HaBo
HaBo

Reputation: 14287

I had this section in web.config i removed it and it worked fine

<section name="Telerik.Reporting" type="Telerik.Reporting.Configuration.ReportingConfigurationSection, Telerik.Reporting, Version=12.2.18.1129, Culture=neutral, PublicKeyToken=a9d7983dfcc261be" allowLocation="true" allowDefinition="Everywhere" />

Upvotes: 1

ArunPratap
ArunPratap

Reputation: 5020

if you are sure that following line does'nt occurs twice in Application_Start then go into the bin folder of project, delete all DLL files becouse if your old assemblies are still part of that, you might be still getting duplicate routes. and then rebuild the project this will solve this problem,

Upvotes: 0

Related Questions