Closed kamhawy4 closed 5 months ago
How many layers do you have on your project? In this case, perhaps MediatR threw the error because it cannot read the assembly where the request handler is implemented. Instead, you can try using the layer assembly of your command handler.
Remember that you can pass the 'array' as an argument into mediatR configuration. It seems that Program.cs assembly just contains the IMediatR <-- probably u use it only for initializing your query/command flow from controllers. However, the real handlers are in the Application Layer for example. So just add one more assembly
builder.Services.AddMediatR(cfg => { cfg.RegisterServicesFromAssemblies([typeof(Program).Assembly, typeof(xxxxxx).Assembly]); });
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days.
This issue was closed because it has been stalled for 14 days with no activity.
services.AddMediatR(config => config.RegisterServicesFromAssemblies(AppDomain.CurrentDomain.GetAssemblies()));
when i execute api give me this error.
the project by core 7
swagger![Screenshot 2023-11-21 111813](https://github.com/jbogard/MediatR/assets/25951080/48b70c4c-cd64-4f8c-88d5-d47ea91de86e)
program.cs
controller