Attribute Routing in ASP.NET Web API 2 | Microsoft Docs[
^]
You have a single route on your action which requires all three parameters to be passed within the URL. When you put the parameters in the querystring, that route no longer matches.
If you want to pass the values in the querystring instead, change your route to:
[HttpGet]
[Route("api/Customer", Name = "GetCustomers")]
public IHttpActionResult GetCustomers(int Id, double num1, double num2)
If you want to support both options, you can have multiple routes on the same action, although they obviously can't have the same name:
[HttpGet]
[Route("api/Customer")]
[Route("api/Customer/{Id}/{num1}/{num2}/", Name = "GetCustomers")]
public IHttpActionResult GetCustomers(int Id, double num1, double num2)
NB: If all of the actions in your controller have the same route prefix, you might want to use
the RoutePrefix
attribute[
^] on your controller instead.
[RoutePrefix("api/Customer")]
public class CustomerApiController : ApiController
{
[HttpGet]
[Route("")]
[Route("{Id}/{num1}/{num2}/", Name = "GetCustomers")]
public IHttpActionResult GetCustomers(int Id, double num1, double num2)