Error constructing handler for request of type MediatR.IRequestHandler

See original GitHub issue
{
  "error": [
    "Error constructing handler for request of type MediatR.IRequestHandler`2[NPPDPayment.Application.Payment.Command.DuplicatePaymentCheckCommand,NPPDPayment.Application.Common.ApiResponse`1[NPPDPayment.Application.Common.DuplicatePaymentResponse]]. Register your handlers with the container. See the samples in GitHub for examples."
  ],
  "stackTrace": "   at MediatR.Internal.RequestHandlerBase.GetHandler[THandler](ServiceFactory factory)\r\n   at MediatR.Internal.RequestHandlerWrapperImpl`2.<>c__DisplayClass1_0.<Handle>g__Handler|0()\r\n   at MediatR.Pipeline.RequestExceptionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)\r\n   at MediatR.Pipeline.RequestExceptionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)\r\n   at MediatR.Pipeline.RequestExceptionActionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)\r\n   at MediatR.Pipeline.RequestExceptionActionProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)\r\n   at MediatR.Pipeline.RequestPostProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)\r\n   at MediatR.Pipeline.RequestPreProcessorBehavior`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)\r\n   at NPPDPayment.Application.Infrastructure.RequestPerformanceBehaviour`2.Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate`1 next)\r\n   at NPPDPayment.WebAPI.Controllers.PaymentController.DuplicatePayment(DuplicatePaymentCheckCommand command)\r\n   at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)\r\n   at System.Threading.Tasks.ValueTask`1.get_Result()\r\n   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync()\r\n   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync()\r\n   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)\r\n   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)\r\n   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync()\r\n   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextExceptionFilterAsync()"
}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:21
  • Comments:37 (5 by maintainers)

github_iconTop GitHub Comments

31reactions
isra-rarcommented, Jan 28, 2022

Hello, I solved using this alternative

services.AddMediatR(AppDomain.CurrentDomain.GetAssemblies());

15reactions
lilasquaredcommented, Feb 19, 2020

Sweet stack trace

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - Error constructing handler for request of type mediatr. ...
Assembly);. When I execute CreateAccountCommand the error occures like bellow: Error constructing handler for request of type MediatR.
Read more >
ASP.NET Core MediatR error: Register your handlers with the ...
i have met the same issue. ... services.addmediatr(typeof(addeducationcommand).gettypeinfo().assembly);. handles all the mediatr irequest and irequesthandlers.
Read more >
Diagnosing and Fixing MediatR Container Issues
These types are all resolved from a container at runtime as MediatR simply defers to an IServiceProvider to resolve handlers/behaviors etc.
Read more >
Error constructing handler for request of type MediatR. ...
Error constructing handler for request of type MediatR.IRequestHandler.
Read more >
asp.net-core - Register your handlers with the container
Send(command); code, i get the following error from my log: Error constructing handler for request of type MediatR.IRequestHandler`2[UniversityService.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found