A diagnostic middleware nuget package for listing all services registered with Startup in an ASP.NET Core applications.
- Install the nuget package.
- Add the following at the bottom of Startup's
ConfigureServices
method:
services.Configure<ServiceConfig>(config =>
{
config.Services = new List<ServiceDescriptor>(services);
// optional - default path to view services is /listallservices - recommended to choose your own path
config.Path = "/mylistallservicespath";
});
- Add the following to your Configure method (in an if block so it only runs in dev environemnt)
if (env.IsDevelopment())
{
app.UseShowAllServicesMiddleware();
app.UseDeveloperExceptionPage();
}
If it's working you should see output like this showing all of your services: