0

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.

Charles
  • 50,943
  • 13
  • 104
  • 142
King Friday
  • 25,132
  • 12
  • 90
  • 84
  • Just out of curiosity do the other methods have default values? – David C May 22 '13 at 22:53
  • No, good question. I did remove the default values as I suspected this to be the case as I've seen similar before in terms of mapping issues. This was not the case. The other methods have either two, 1 or no params. This method is taking from the query string by the way. Some others are as well and working fine. All I can tell is 3 params. I did trying to remove the params as well just to see it generate and could not see. I'm thinking it may be to do with the model or something else but I'm new to ASP.NET MVC in general although I've worked on so many other technologies. This is frustrating. – King Friday May 22 '13 at 22:58
  • Hrm..I have never seen a return encapsulated like that either. Try just returning a boolean or something simple as a test. – David C May 22 '13 at 23:01
  • So I am guessing Info is a generic type, which you are casting to a generic list of job title locations. Are the return types the same on any of the other controller methods that are being generated? – David C May 23 '13 at 13:53
  • The return type is similar to other methods but I will look into this. – King Friday May 23 '13 at 14:40

1 Answers1

1

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

David C
  • 3,610
  • 3
  • 21
  • 23
  • Thanks, but I tried the prior before writing. That was a good idea though. – King Friday May 23 '13 at 02:22
  • I'll just default you the answer because of your effort. I appreciate you trying. Its one of those hard problems there isn't enough information I can give you because this code is proprietary. – King Friday May 24 '13 at 03:28