This package integrates NServiceBus with the ASP.NET Core 2.x host (WebHost).
DO NOT USE THIS PACKAGE IF YOU ARE ON ASP.NET CORE 3! Use https://github.com/Particular/NServiceBus.Extensions.Hosting instead.
- Install the
Community.NServiceBus.WebHost
package. - In the
ConfigureServices
method of theStartup
class, useservices.AddNServiceBus
to pass an endpoint configuration:
public void ConfigureServices(IServiceCollection services)
{
...
var endpointConfiguration = new EndpointConfiguration(<endpoint-name>);
// configure the endpoint here
services.AddNServiceBus(endpointConfiguration);
}
This extensions registers IMessageSession
with the DI container so it can be injected into controllers, page models and more.
See the demo project in this repository for an example usage.