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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

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

Thread ID:

Created:

Updated:

Platform:

Replies:

125981 Sep 15,2016 06:49 PM UTC Sep 19,2016 05:40 AM UTC ASP.NET MVC 4
loading
Tags: ReportViewer
Norberto
Asked On September 15, 2016 06:49 PM UTC

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


Yuvaraj Devarajan [Syncfusion]
Replied On 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. 


Norberto
Replied On 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)

Norberto
Replied On September 16, 2016 04:19 PM UTC

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

Ty

Yuvaraj Devarajan [Syncfusion]
Replied On 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. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;