Unable to get ASP.NET MVC and Web API routing straight in my mind - getting 404s galore -


i struggling routing issues in asp.net mvc + webapi app. feel have moving target here because when add or change 1 route break another. here specific example.

first, controllers, can see names:

enter image description here

next, mvc routing config (i understand config duplicative, because trying things):

enter image description here

and web api routing config (i understand config duplicative, because trying things):

enter image description here

as routing problem example, here's podcastfeeds api controller:

enter image description here

so post create action method...

enter image description here

and can see error: 404 not found - "no http resource found matches request uri.

i love direction here...

the order or registering routes important since requests handled firs route matches patter. because default route first 1 selected. you need put default route last 1 , register routes starting constraining , ending default one. see in screenshots of routes not configured: example api/podcastfeeds route doesn't specify controller (it needs similar feedroutemap route second screenshot):

routes.maphttproute(   name: "podcastfeeds",   url: "api/podcastfeeds/{action}/{id}",   defaults: new {controller="podcastfeeds", action="create", id=urlparameter.optional}) 

as alternative can use attribute routing avoid kind of issues.


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -