ASP.NET Core MediatR error: Register your handlers with the container : <p>I have a .Net Core app where i use the <code>.AddMediatR</code> extension to register the assembly for my commands and handlers following a CQRS approach.</p>

<p>In ConfigureServices in Startup.cs i have used the extension method from the official package <code>MediatR.Extensions.Microsoft.DependencyInjection</code> with the following parameter:</p>

<pre><code>services.AddMediatR(typeof(AddEducationCommand).GetTypeInfo().Assembly);  
</code></pre>

<p>The command and commandhandler classes are as follow:</p>

<p><strong>AddEducationCommand.cs</strong></p>

<pre><code>public class AddEducationCommand : IRequest&lt;bool&gt;
{
    [DataMember]
    public int UniversityId { get; set; }

    [DataMember]
    public int FacultyId { get; set; }

    [DataMember]
    public string Name { get; set; }
}
</code></pre>

<p><strong>AddEducationCommandHandler.cs</strong></p>

<pre><code>public class AddEducationCommandHandler : IRequestHandler&lt;AddEducationCommand, bool&gt;
    {
        private readonly IUniversityRepository _repository;
        public AddEducationCommandHandler(IUniversityRepository repository)
        {
            _repository = repository;
        }

        public async Task&lt;bool&gt; Handle(AddEducationCommand command, CancellationToken cancellationToken)
        {
            var university = await _repository.GetAsync(command.UniversityId);

            university.Faculties
                .FirstOrDefault(f =&gt; f.Id == command.FacultyId)
                .CreateEducation(command.Name);

            return await _repository.UnitOfWork.SaveEntitiesAsync();
        }
    }
</code></pre>

<p>When i run the REST endpoint that executes a simple <code>await _mediator.Send(command);</code> code, i get the following error from my log:</p>

<pre><code>Error constructing handler for request of type MediatR.IRequestHandler`2[UniversityService.Application.Commands.AddEducationCommand,System.Boolean]. Register your handlers withthe container. See the samples in GitHub for examples.
</code></pre>

<p>I tried to look through the official examples from the docs without any luck. Does anyone know how i configure MediatR to work properly? Thanks in advance.</p>
