0

I am completely baffled by this. I have a public method on my controller which works on my development machine. But when I deploy the app I get an error message saying the method is not found;

    [HttpGet]
    [Authorize(Roles = "Administrator, AdminIT, ManagerIT")]
    public ActionResult ListExistingIT(GridSortOptions sort, int? page)
    {
        if (Request.QueryString["lastPersonMessage"] == null)
            ViewData["LastPersonMessage"] = string.Empty;
        else
            ViewData["LastPersonMessage"] = Request.QueryString["lastPersonMessage"];
        EmployeeListViewModel elvm = new EmployeeListViewModel();
        elvm.EmployeeList = EmployeeExtended.GetITEmployees();
        if (sort.Column != null)
        {
            elvm.EmployeeList = elvm.EmployeeList.OrderBy(sort.Column, sort.Direction);
        }
        elvm.EmployeeList = elvm.EmployeeList.AsPagination(page ?? 1, Utility.GetPageLength());
        ViewData["sort"] = sort;
        return View(elvm);
    }

The error message is; System.Web.HttpException: A public action method 'ListExistingIT' was not found on controller 'SHP.Controllers.EmployeeController'.

Now you might think that IIS is not picking up the latest deployment. However I make a change elsewhere and deploy it, and that works. I also restart IIS as well. I cannot imagine how this happens, or how to detect where the error could be.

arame3333
  • 9,887
  • 26
  • 122
  • 205

2 Answers2

1

There is plenty of discussion on a similar (the same?) issue here on SO:Intermittent asp.net mvc exception: “A public action method ABC could not be found on controller XYZ.”

Community
  • 1
  • 1
jlnorsworthy
  • 3,914
  • 28
  • 34
0

I can think of 3 different possibilities:

  1. A conflict with the HttpVerb causing the method not to be found.
  2. A conflict with the filters applied causing the method to be avoided.
  3. A routing issue, but this one is probably the last possibility. You may want to try testing with the RouteDebugger and see what that shows you.
Gup3rSuR4c
  • 9,145
  • 10
  • 68
  • 126