GomuGomuNoRocket
GomuGomuNoRocket

Reputation: 819

Telerik Reporting Services

i have a MVC project, i try to add Telerik Reporting Services inside.

I have added this references

Telerik.Reporting
Telerik.Reporting.Services.WebApi
Telerik.Reporting.XpsRendering
Telerik.ReportViewer.Mvc

Also, in my WepApiConfig

public static class WebApiConfig
{
    public static void Register(HttpConfiguration config)
    {

       // config.MapHttpAttributeRoutes();

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

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

And when i run my project i get this exception

Method not found: 'Void Telerik.Reporting.Services.WebApi.ReportsControllerConfiguration.RegisterRoutes

Has anyone a clue about what happens?

Upvotes: 1

Views: 952

Answers (1)

Muhammad Assar
Muhammad Assar

Reputation: 689

The cause of this error is that The Reporting REST WebAPI Service is built against WebAPI 1.

And in your case you are using a newer version (WebAPI 2).

So, you have to redirect the System.Web.Http and System.Net.Http.Formatting to their newer version.

To do this, add the following bindingRedirects to your web.config:

<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Http" culture="neutral" publicKeyToken="31bf3856ad364e35"/>
        <bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="5.2.3.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Net.Http.Formatting" culture="neutral" publicKeyToken="31bf3856ad364e35"/>
        <bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="5.2.3.0"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

and replace

5.2.3.0

with your current version, as 5.2.3.0 is currently the most recent one.

and if your web.config already contains the section, just append the nodes to it.

taken from this article

Upvotes: 1

Related Questions