m0r6aN
m0r6aN

Reputation: 908

MVC4 View cannot find Controller Action

I;m try to call a simple action in my controller and receiving a 404. All other actions in the controller work fine; although they are called via AJAX.

The Button

<a href="@Url.Action("RestartEmailService", "Email")" class="btn btn-success btn-mini"><i class="icon-white icon-envelope"></i> Restart Service</a>

The controller action

[AcceptVerbs(HttpVerbs.Get)]
    protected ActionResult RestartEmailService()
    {
        try
        {
            svcController.Stop();
            svcController.WaitForStatus(ServiceControllerStatus.Stopped, TimeSpan.FromSeconds(10));
            svcController.Start();

            return RedirectToAction("EmailAdminCenter");
        }
        catch (Exception ex)
        {
            return JavaScript(UnHandledEx);
        }
    }

Upvotes: 0

Views: 763

Answers (1)

Ehsan Sajjad
Ehsan Sajjad

Reputation: 62488

It is not called because it is protected not public so it is not visible, it should be public:

public ActionResult RestartEmailService()
{

}

Upvotes: 1

Related Questions