Multiple actions were found that match the request Web API.


When we create a Web API, it creates a default route “api/{controller}/{id}” in WebApiConfig.cs file. Action name is not defined in the route.

Web API by default serves to HTTP verbs Get, Post, Put, Delete with optional parameters.

// GET api/values
public IEnumerable<string> Get()
{
    return new string[] { "value1", "value2" };
}

// GET api/values/5
public string Get(int id)
{
    return "value";
}

//POST api/values
public void Post([FromBody]string value)
{
}

// PUT api/values/5
public void Put(int id, [FromBody]string value)
{
}

// DELETE api/values/5
public void Delete(int id)
{
}


Web API identifies the action with http verbs. If we have more than one action method with same HTTP verb and same parameters then it is very difficult for web api to serve the correct method. So it returns the error message “Multiple actions were found that match the request”.

Multiple actions were found that match the request Web API

Multiple actions were found that match the request Web API

To resolve this confusion we have to define “action” in the route as “api/{controller}/{action}/{id}”.

[HttpPost]
public void AddEmployee(Employee value)
{
    // return emp;
}


Now it will be able to identify AddEmployee action method.