-1

I have an ASP.NET MVC application where I have activated WEB API 2 routing. When the application launches with the default url the default action is not being called. I am getting the following message:

"Message": "The requested resource does not support http method 'GET'."

This started occurring when I activated the [controller specific] routing feature via the config.MapHttpAttributeRoutes() operation.

If I do not include this call the default action does get called.

If I leave the call in - I can still access the actions by specifically including them in the URL -- like XXX/Home/ XXX/Home/Index

I have incorporated routing in previous applications. This application is a take over for me, and I cannot identify why the default action is not being called.

CodeCaster
  • 147,647
  • 23
  • 218
  • 272
Peter
  • 173
  • 12

1 Answers1

0

It is unclear what is actually happening, but it appears the WEB API routing was getting in the way when interpreting the base url. I do not know why this is the case as the routing for WEB API is based on a different routing signature. But when the dynamic API routing was turned on this issue started to occur. I solved the issue with a work around where I applied a new route handler and applied it to an empty route definition that had to be registered before all other route configs.

This is not ideal, and I still have to figure out why the WEB API routes are getting in the way.

Peter
  • 173
  • 12