question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Endpoint Routing incompatible with API versioning

See original GitHub issue

Describe the bug

UrlHelpers cannot locate routes when controller route contains api version.

InvalidOperationException: No route matches the supplied values. Microsoft.AspNetCore.Mvc.CreatedAtActionResult.OnFormatting(ActionContext context)

Disabling Endpoint Router restores correct behaviour.

To Reproduce

Steps to reproduce the behaviour:

  1. Get attached reproduction: bug.zip
  2. Run the application
  3. Navigate to http://localhost:5002/Bar (SUCCESS)
  4. Navigate to http://localhost:5002/v1/Foo (FAIL)
  5. Toggle EnableEndpointRouting in startup (see .AddMvcCore(options => options.EnableEndpointRouting = true))
  6. Navigate to http://localhost:5002/v1/Foo (SUCCESS)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
commonsensesoftwarecommented, Dec 22, 2018

API Versioning 3.1 has been released and includes support for Endpoint Routing.

@AdamWillden unless you are continuing to observe issues, I believe this issue can now be closed.

cc: @Eilon

0reactions
AdamWilldencommented, Dec 24, 2018

Wow, that’s really kind of you. I’ll try this out once the wine wears off 🍷 … Maybe Friday 🙄 . I’ll close as you’ve obviously sorted this for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unsupported API version with versions within URI
The API controller has three different routes for test purposes. Notice that the controller itself has no [Route()] or [ApiVersion()] ...
Read more >
API versioning extension with ASP.NET Core OData 8
NET Core, has the built-in API versioning functionality via route URL ... We need a routing matcher policy to select the best endpoint....
Read more >
API versioning and changelog
This page covers backwards-incompatible, versioned API changes. For a list of all API updates, including non-versioned ones, see the changelog.
Read more >
Your Guide to REST API Versioning in ASP.NET Core
Introducing Multiple Versions for a Single Endpoint. Let's say we want to work with two versions of our API, 1.0 and 2.0. We...
Read more >
.NET Handbook | Api / Versioning
Implementing API versioning in code is highly dependent on the existing codebase - it can be as simple as adding a minor revision...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found