0

I have two projects - one MVC and other Web Api. Both have one controller with the same name (DealsController).

It is working fine since we have specific route mentioned in all actions for Web Api deals controller.

Web api deals controller looks like:

public class DealsController : ApiController
{
        [Route("api/advantage/getDeals/")]
        public IHttpActionResult GetDeals([FromUri] CompanyName.Entity.Deals.Filters filter)
        {

        }
}

Both are working fine till the time i install package - Microsoft.AspNet.WebApi. Once i am installing this package in my project that has web api, this action starts giving me error.

{
  "Message": "No HTTP resource was found that matches the request URI 'http://localhost/api/advantage/getDeals/?cityId=10&sc=0&so=1&pn=1'.",
  "MessageDetail": "No type was found that matches the controller named 'advantage'."
}
Sahil Sharma
  • 3,847
  • 6
  • 48
  • 98
  • Have you enabled Attribute Routing in your web api? – jpgrassi Aug 06 '16 at 13:58
  • Yes. It is working fine with other Web api controllers. They are using route too. Issue is with this controller since its duplicate – Sahil Sharma Aug 06 '16 at 14:00
  • What's your MVC controller look like? Couldn't reproduce the problem here.. Also, you installed Microsoft.AspNet.WebApi in the Web api project, correct? – jpgrassi Aug 06 '16 at 14:11
  • http://stackoverflow.com/questions/38802824/unable-to-hit-duplicate-controller-route-after-installing-fluentvalidation-webap This is another question i posted for same problem. This has definition of mvc controller. – Sahil Sharma Aug 06 '16 at 14:13
  • It seems confusing. You have 1 project for both MVC and Web api? Or each of them are different projects in the same solution? – jpgrassi Aug 06 '16 at 14:15
  • I have different projects in the same solution. – Sahil Sharma Aug 06 '16 at 14:16

0 Answers0