You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
to a NET5.0 Razor Pages project created from the default template also throws the UnsupportedApiVersion error:
{"error":{"code":"UnsupportedApiVersion","message":"The HTTP resource that matches the request URI 'http://localhost:5000/' is not supported.","innerError":null}}
Are you saying this only happens if you use MapFallbackToPage? API Versioning does not consider endpoints that do not use [ApiController] conventions. Do you have a repro?
Are you saying this only happens if you use MapFallbackToPage? API Versioning does not consider endpoints that do not use [ApiController] conventions. Do you have a repro?
Yes.
And yes, very simple:
Create new project from template "ASP.NET Core Web Application" using C# - select "ASP.NET Core Web App" in the "Create a new ASP.NET Core web application"-page of the wizard
Run the application - it will start and show the index-Page (big 'Welcome' Headline)
Stop the application.
Add NuGet-Reference to Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer (5.0.0-preview.1)
Open Startup.cs
Add services.AddApiVersioning(); to ConfigureServices()-Method (after Line 26)
Add endpoints.MapFallbackToPage("/Index"); to Configure()-Method (after Line 50)
Start application again and voilà: the ApiVersionUnspecified-Error shows
It turns out this is a regression due to IDynamicEndpointMetadata. API Versioning previously didn't care about this at all, but OData makes extensive use of it. It turns out that other policies such as mapping a fallback also uses this. I need to dig in some more to figure out how to disambiguate dynamic OData routes or whether there is an alternative.
Thanks for trying out the preview and reporting this. It will almost certainly affect the current release candidate too.
Sorry to say, but adding
and
to a NET5.0 Razor Pages project created from the default template also throws the UnsupportedApiVersion error:
{"error":{"code":"UnsupportedApiVersion","message":"The HTTP resource that matches the request URI 'http://localhost:5000/' is not supported.","innerError":null}}
Referenced ApiExplorer is 5.0.0-preview.1
Originally posted by @DNF-SaS in #189 (comment)
The text was updated successfully, but these errors were encountered: