I am working on MVC5. I just Added a API Controller & facing error in WebApiConfig. The Error is- ambiguous reference system web http routeparameter. I don't understand from where Ambiguity is creating. Can any one please explain??
MyCode is:
using System.Web.Http;
namespace MyProject
{
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
config.MapHttpAttributeRoutes();
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
}
}
}
I am done with the problem. The ambiguity for System.web.http is between System.Web.Http.Common & Microsoft.AspNet.WebApi.Core. I just removed System.Web.Http.Common from my solution as Microsoft.AspNet.WebApi.Core is doing the same stuff for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With