If you setup your ASP.NET Core project with Api Versioning, Alba will give 404s for nearly all routes.
I tracked this down to the following line of code from this sample:
app.UseSwaggerUI(
options =>
{
// build a swagger endpoint for each discovered API version
foreach ( var description in provider.ApiVersionDescriptions )
{
options.SwaggerEndpoint( $"/swagger/{description.GroupName}/swagger.json", description.GroupName.ToUpperInvariant() );
}
} );
IApiVersionDescriptionProvider implementation appears to lazy-load the route/action information. When that code is run in Alba, it does appear to have the correct versioning information. However, doing a get request through Alba you get a 404. If you comment out the foreach then Alba works fine.
This seems to be some sort of timing issue. My only other guess is that the route versioning information is somehow not loaded properly when that class is initialized. The versioning appears to use an IStartupFilter to register route information, as shown here. Think that could possibly be related?
If you setup your ASP.NET Core project with Api Versioning, Alba will give 404s for nearly all routes.
I tracked this down to the following line of code from this sample:
IApiVersionDescriptionProvider
implementation appears to lazy-load the route/action information. When that code is run in Alba, it does appear to have the correct versioning information. However, doing a get request through Alba you get a 404. If you comment out theforeach
then Alba works fine.This seems to be some sort of timing issue. My only other guess is that the route versioning information is somehow not loaded properly when that class is initialized. The versioning appears to use an
IStartupFilter
to register route information, as shown here. Think that could possibly be related?IStartupFilter
's do appear to be called (I wrote a custom one to see that it did). Any ideas @jeremydmiller ?