Question

I've tried to step through this extensively and could not find the answer. There are about 30 methods defined that all map correctly but this single method does not. It differs because it has 3 params while the others do not.

[HttpGet]
public Info<List<SEOJobTitleLocation>> GetSeoTopLocations(string jobTitle, string city = "", string state = "")
{
    return _jobs.GetSeoTopLocations(jobTitle, city, state);
}

and the Areas code is as follows:

    public override void RegisterArea(AreaRegistrationContext context)
    {
        context.Routes.MapHttpRoute(
            name: "AreaApi",
            routeTemplate: "api/{controller}/{id}",
            defaults: new { area = AreaName, id = RouteParameter.Optional },
            constraints: new { id = @"^\d+$" }
        );

        context.Routes.MapHttpRoute(
            name: "AreaApiWithAction",
            routeTemplate: "api/{controller}/{action}/{id}",
            defaults: new { area = AreaName, action = "get", id = RouteParameter.Optional }
        );
    }

I've gone as far as downloading the symbols from Microsoft to step through the build and could see this particular method is not being generated in the code. I have absolutely no clue as to why. Sorry I cannot give more info than that.

The specific error message I get is as follows:

No HTTP resource was found that matches the request URI...

Thank you for looking into this in advance.

Was it helpful?

Solution

Try removing the two optional parameters and "defaulting" those inside the function, just as a test to see if it will instantiate the function.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top