WebAPI No action was found on the controller

Solution 1:

This is because there is a parameter name mismatch. From your route the value 1 is assigned to parameter named id and your action is looking for parameter named moduleId.

First option is to change your route like this:

config.Routes.MapHttpRoute(
    name: "DefaultApi",
    routeTemplate: "api/{controller}/{action}/{moduleId}",
    defaults: new { moduleId = RouteParameter.Optional }
);

Second is to change your URL like this:

http://localhost:37331/api/action/FindByModule?moduleId=1

So the parameter name match.

Solution 2:

My api had too many parameters and I was getting an error. I solved the problem with Route.

[Route("addressverification/{id}/{no}/{day}/{month}/{year}")]
public AdressVerificationResult  Get(long? id, long? no ,long? day, long? month, long? year)
        {
        
        return new AdressVerificationResult  
            {
                Aciklama = "19........4 kimlik numaralı kişinin 18.......1 adres numarasında 'YerlesimYeri' adres tipi için geçerli bir yurtiçi adres beyanı mevcuttur.",
                DurumKod = true
            };


         }