Skip to content
This repository was archived by the owner on Nov 27, 2018. It is now read-only.
This repository was archived by the owner on Nov 27, 2018. It is now read-only.

No route candidate coming back to Mvc when it should be resolvable  #316

@NinoFloris

Description

@NinoFloris

Ok given these routes, and this url http://example.com/ptslug/slug it should be clear that the bottom most route and accompanied action should be triggered.

        [HttpGet]
        public Task<IEnumerable<Model>> GetAll(...) { ... }

        [HttpGet("{ptSlug}")]
        public Task<IEnumerable<Model>> GetAllByPtSlug(...) { ... }

        [HttpGet("{id:int}")]
        public Task<Model> GetById(...) { ... }

        [HttpGet("{ptSlug}/{slug}")]
        public Task<Model> GetByPath(...) { ... }

However, as I have debugged the http://github.com/aspnet/Mvc project it does not even get to the point of selecting an action, which normally happens in the ActionSelector. Breakpointing this class revealed that it did not get entered.

Changing this routes' Order to any number (either putting it in front of all the other routes or behind them) fixes this.

        [...]

        [HttpGet("{ptSlug}/{slug}", Order=1)]
        public Task<Model> GetByPath(...) { ... }

In turn it enters the ActionSelector and onwards into my code.

What is going on here?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions