Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

API Controllers with Telerik Reporting #4969


User avatar
0
Mitch created

I'm trying to get Telerik Reporting working with ASP.Net Zero

Part of the setup is to create an API controller.

I'm following the instructions for getting the Telerik Reporting working on ASP.Net Core ([https://docs.telerik.com/reporting/html5-report-viewer-asp-net-core-2#creating-a-sample-asp-net-core-project]))

However, I'm getting an error.

HTTP500: SERVER ERROR - The server encountered an unexpected condition that prevented it from fulfilling the request. GET - <a class="postlink" href="http://localhost:62114/api/reports/resources/js/telerikReportViewer-12.0.18.227.min.js">http://localhost:62114/api/reports/reso ... 227.min.js</a>

Are there any special considerations when setting up API controllers with ASP.Net Zero that I'm missing?

I already have Telerik Reporting running with an existing MVC app so I have had success in the past. I'm just concerned that there's something that I need to do in my ASP.Net Zero Web.Mvc when using API controllers.

Any ideas?


6 Answer(s)
  • User Avatar
    0
    aaron created
    Support Team

    Can you show the error in Logs.txt?

  • User Avatar
    0
    Mitch created

    Thanks for getting back so quick Aaron.

    Could it be to do with the Logger? I'm just a bit confused as this is the first time I've tried using an API Controller with ASP.Net Zero.

    ERROR 2018-04-09 18:42:52,958 [11 ] Mvc.ExceptionHandling.AbpExceptionFilter - No component for supporting the service DpmsCloud.Web.Controllers.ReportsController was found Castle.MicroKernel.ComponentNotFoundException: No component for supporting the service DpmsCloud.Web.Controllers.ReportsController was found at Castle.MicroKernel.DefaultKernel.Castle.MicroKernel.IKernelInternal.Resolve(Type service, IDictionary arguments, IReleasePolicy policy) at Castle.MicroKernel.DefaultKernel.Resolve(Type service, IDictionary arguments) at Castle.Windsor.WindsorContainer.Resolve(Type service) at Castle.Windsor.MsDependencyInjection.ScopedWindsorServiceProvider.ResolveInstanceOrNull(Type serviceType, Boolean isOptional) at Castle.Windsor.MsDependencyInjection.ScopedWindsorServiceProvider.GetServiceInternal(Type serviceType, Boolean isOptional) at Castle.Windsor.MsDependencyInjection.ScopedWindsorServiceProvider.GetRequiredService(Type serviceType) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType) at Microsoft.AspNetCore.Mvc.Controllers.ServiceBasedControllerActivator.Create(ControllerContext actionContext) at Microsoft.AspNetCore.Mvc.Controllers.ControllerFactoryProvider.<>c__DisplayClass5_0.<CreateControllerFactory>g__CreateController|0(ControllerContext controllerContext) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeInnerFilterAsync>d__15.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.<InvokeNextExceptionFilterAsync>d__23.MoveNext()

  • User Avatar
    0
    aaron created
    Support Team

    Try implementing ITransientDependency:

    public class ReportsController : ReportsControllerBase, ITransientDependency
    {
        // ...
    }
    
  • User Avatar
    0
    Mitch created

    Many thanks for the advise Aaron, it worked! However there now seems to be further issues as the api URL's don't seem to be working and apparently this is caused by the api routing not working.

    To be honest this is becoming a pain and I'm considering using a different reporting system with ASP Net Zero.

    Thanks again for your help last week.

  • User Avatar
    0
    alper created
    Support Team

    If you're using CORE then you can route your application services (API) with attribute routing. Application services are being converted to controllers at runtime. Currently, application service project doesn't have a reference for the aspnet core. Add that required web references to the application service layer. <a class="postlink" href="https://docs.microsoft.com/en-us/aspnet/core/mvc/controllers/routing?view=aspnetcore-2.1#attribute-routing">https://docs.microsoft.com/en-us/aspnet ... te-routing</a>

  • User Avatar
    0
    alper created
    Support Team

    btw folks are talking about PowerBI to integrate with AspNet Zero. Check out the topic #4979