We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Starting in 2019, the Reporting control is no longer included in Essential Studio. If you're experiencing issues with the Syncfusion Reporting Platform, Report Viewer, Report Designer, or Report Writer, we recommend migrating to Bold Reports, our dedicated reporting platform.

Bold Reports offers a comprehensive suite of tools and features for all your reporting needs, and we will help you make a smooth transition from the discontinued control. Our support team at https://support.boldreports.com/ is here to assist you with any questions or difficulties you may encounter during the migration process.

We thank you for choosing Syncfusion and appreciate your understanding.

The controller for path '/api/ReportApi/PostReportAction'; was not found or does not implement IController.

Hello,
I'm new using Syncfusion.
I'm trying to make an example following documentation

Load RDLC Reports
https://help.syncfusion.com/aspnetmvc/reportviewer/getting-started#load-rdlc-reports

This is my view.

@using Syncfusion.JavaScript
@using Syncfusion.MVC.EJ

@{
    ViewBag.Title = "Index";
}
<h2>Index</h2>
<div style="width:100%">

    @(Html.EJ().ReportViewer("viewer").ProcessingMode(Syncfusion.JavaScript.ReportViewerEnums.ProcessingMode.Local)
        .ReportPath("~/Reports/MemoriasDeCalculoCantidades.rdlc")
        .ReportServiceUrl(VirtualPathUtility.ToAbsolute("~/api/ReportApi"))
        .DataSources(ds => ds.Name("DataSetCapitulo").Value(ViewData["Capitulo"]).Add()))

</div>



@section styles{


}

@section scripts{
    <script src="~/Scripts/Reportes/jquery.easing.min.js"></script>
    <script src="~/Scripts/Reportes/ej.web.all-latest.min.js"></script>
    <script src="~/Scripts/Reportes/ej.unobtrusive-latest.min.js"></script>
}



This is my controller

using Interventorias.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Interventorias.Controllers
{
    public class ReportController : Controller
    {
        private InterventoriasEntities db = new InterventoriasEntities();

        // GET: Report
        public ActionResult index()
        {
            ViewData["Capitulos"] = db.sp_capitulos(1);
            return View();
        }
    }
}


This is my api

using Syncfusion.EJ.ReportViewer;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;
using System.Web.Http;

namespace Interventorias.api
{
    public class ReportApiController : ApiController, IReportController
    {
        //Post action for processing the rdl/rdlc report
        public object PostReportAction(Dictionary<string, object> jsonResult)
        {
            return ReportHelper.ProcessReport(jsonResult, this);
        }
        //Get action for getting resources from the report
        [System.Web.Http.ActionName("GetResource")]
        [AcceptVerbs("GET")]
        public object GetResource(string key, string resourcetype, bool isPrint)
        {
            return ReportHelper.GetResource(key, resourcetype, isPrint);
        }
        //Method will be called when initialize the report options before start processing the report
        public void OnInitReportOptions(ReportViewerOptions reportOption)
        {
            //You can update report options here
        }
        //Method will be called when reported is loaded
        public void OnReportLoaded(ReportViewerOptions reportOption)
        {
            //You can update report options here
        }
    }
}




This is my Global.asax.cs

public class MvcApplication : System.Web.HttpApplication
    {
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            System.Web.Mvc.ModelBinders.Binders.Add(typeof(decimal), new DecimalModelBinder());
            System.Web.Mvc.ModelBinders.Binders.Add(typeof(decimal?), new DecimalModelBinder());
            System.Web.Http.GlobalConfiguration.Configuration.Routes.MapHttpRoute(
            name: "DefaultApi",
            routeTemplate: "api/{controller}/{action}/{id}",
            defaults: new { id = RouteParameter.Optional });
        }
    }




And this is the error that occurs:

[HttpException]: The controller for path &#39;/api/ReportApi/PostReportAction&#39; was not found or does not implement IController.

   en System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType)

   en System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName)

   en System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory)

   en System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state)

   en System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state)

   en System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)

   en System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()

   en System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)


Thank you very much,
Sorry for my English


4 Replies

YD Yuvaraj Devarajan Syncfusion Team September 16, 2016 10:51 AM UTC

Hi Norberto, 

Thanks for contacting Syncfusion support. 

The mentioned issue might have occurred due to Web API dependent assemblies are not referred properly in your application. So can you please refer the Web API dependent assemblies in your application to avoid the mentioned issue at your end. 
·         System.Web.Routing   
·         System.Web.Http 
·         System.Web.WebHost 
·         System.Net.Http 
·         System.Net.Http.WebRequest 
·         System.Net.Http.Formatting 

And also please enable the IIS request modules mapped for all requests in Web.config file as shown in below example. 
<system.webServer> 
    <validation validateIntegratedModeConfiguration="false"/>  
    <modules runAllManagedModulesForAllRequests="true"/> 
</system.webServer> 

Please refer the below MSDN forum for more details on this, 

We have prepared the sample and it can be downloaded from below location, 

Please refer to the below UG documentation for more details about sample creation, 

If the issue still persists, then share your issue reproducible sample with us to validate this issue. 

Regards, 
Yuvaraj D. 



NO Norberto September 16, 2016 03:23 PM UTC

Hello Yuvaraj D.

Thanks, solved the above problem, it was just a matter of adding the class WebApiConfig hehe

But I will now present another problem, the report view


_getDataSourceCredential:Sf_Exception - System.Collections.Generic.KeyNotFoundException: La clave proporcionada no se encontró en el diccionario.
   en System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   en Syncfusion.EJ.ReportViewer.ReportViewerModel.UpdateJsonReportModel(ReportModel reportmodel, Dictionary`2 json)
   en Syncfusion.EJ.ReportViewer.ReportHelper.GetDataSourceCredential(Dictionary`2 jsonResult, IReportController _reportController)
   en Syncfusion.EJ.ReportViewer.ReportHelper.ProcessReport(Dictionary`2 jsonResult, IReportController reportController)


NO Norberto September 16, 2016 04:19 PM UTC

Sorry.
Ops, in my viewdata, missing a letter jajaja

Ty


YD Yuvaraj Devarajan Syncfusion Team September 19, 2016 05:40 AM UTC

Hi Norberto, 

Thanks for the update. We are happy to hear that your issue is resolved. 

Please let us know if you need further assistance. 

Regards, 
Yuvaraj D. 


Loader.
Up arrow icon