Base solution for your next web application
Open Closed

Exception: Can't create component 'Abp.AspNetCore.Mvc.Antiforgery.AbpAutoValidateAntiforgeryTokenAuthorizationFilter' #12066


User avatar
0
razkhan78 created

Hi Team,

We are upgrading our existing application (Asp.net Core MVC + Jquery with framework .net2.1 and version 6.2.1.) to .net 8 and version 13.1.1. following documentation (Version-Updating).

In Startup.cs we have added below line // MVC var mvcBuilder = services.AddControllersWithViews(options => { options.Filters.Add(new AbpAutoValidateAntiforgeryTokenAttribute()); options.AddAbpHtmlSanitizer(); });

We are facing below exception when project runs.

Exception: HandlerException: Can't create component 'Abp.AspNetCore.Mvc.Antiforgery.AbpAutoValidateAntiforgeryTokenAuthorizationFilter' as it has dependencies to be satisfied. 'Abp.AspNetCore.Mvc.Antiforgery.AbpAutoValidateAntiforgeryTokenAuthorizationFilter' is waiting for the following dependencies: - Service 'Castle.Core.Logging.ILogger' which was not registered.


7 Answer(s)
  • User Avatar
    0
    m.aliozkaya created
    Support Team

    Hi @razkhan78,

    Does your upgraded project have the same NuGet packages as the new version? Especially for Castle packages

  • User Avatar
    0
    razkhan78 created

    Hi @m.aliozkaya

    All the packages are updated but still facing issue.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @razkhan78

    Could you share your project with [email protected] ? We can take a look at this problem for you.

  • User Avatar
    0
    razkhan78 created

    @ismcagdas

    Its not possible to share the project. Is there any other way to resolve this issue?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Do you have .AddFacility<LoggingFacility> in your Startup.cs file ? Since this doesn't happen on a not modified project, I think seeing your project will help us to understand the problem.

  • User Avatar
    0
    razkhan78 created

    Issue resolved by Adding .AddFacility<LoggingFacility> in Startup.cs file.

    Thanks @ismcagdas

  • User Avatar
    0
    ismcagdas created
    Support Team

    Great :)