R2 2016 not possible to load System.Web.Http and Error registering the viewer with the service.

2 posts, 0 answers
  1. Fernando
    Fernando avatar
    56 posts
    Member since:
    Sep 2012

    Posted 13 May Link to this post

    Hello guys, I am trying to configure Telerik Reporting for Html5 in my asp.net mvc 5 application (.Net Framework 4.5). I have another application using asp.net mvc 4 (.net 4.0) that works fine but in mvc 5 and .net 4.5 it fails. I have referenced in my asp.net mvc application the assemblies "Telerik.Reporting" and "Telerik.Reporting.Services.WebApi" (set Copy Local = true) of R2 2016 version of Telerik Reporting. I have configured the handlers in the web.config file too.

    In the WebApiConfig.cs file that configure the routes for the web api, I have added the line to configure the routes for telerik reporting api.
    public static void Register(HttpConfiguration config)
    {
      // Web API routes
      config.MapHttpAttributeRoutes();
     
      config.Routes.MapHttpRoute(
        name: "DefaultApi",
        routeTemplate: "api/{controller}/{id}",
        defaults: new { id = RouteParameter.Optional }
      );
     
      // configure routes for telerik reporting
      Telerik.Reporting.Services.WebApi.ReportsControllerConfiguration.RegisterRoutes(config);
    }


    The problem is, if I add this line that configure the routes for telerik reporting, I get an error

    Could not load file or assembly 'System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'...

    If I remove the line, the application runs fine, but when I try to execute a page with a report, I get another error on the report viewer like this:

    Error registering the viewer with the service.
    No HTTP resource was found that matches the request URI 'http://localhost:54925/Api/Reports/clients'.


    Am I missing something? Is it a problem with the version of .net framework? How can I get it working for asp.net mvc 5 and .net framework 4.5?

    Thank you.

  2. Stef
    Admin
    Stef avatar
    3053 posts

    Posted 14 May Link to this post

    Hi Fernando,

    In Telerik Reporting R2 2016 we detected a problem with the VS item templates for adding the HTML5 Viewer. The issue is fixed in the latest available internal build v10.1.16.513. Internal builds can be downloaded from your Telerik account - Products&Subscriptions - Latest Internal Builds.


    In case the project uses greater versions of the Nuget packages added also by the VS item template, you will have to make an update through the VS Nuget Package Manager. Visual Studio must add proper binding redirects in the root level's web.config.

    Regards,
    Stef
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. DevCraft banner
Back to Top