Note that there are some explanatory texts on larger screens.

plurals
  1. POASP.Net MVC 2: My controller actions are not being called
    text
    copied!<p>I'm not sure what happend but suddenly my controller actions are not being called. This project has been working fine all day, but now when I run it (in Cassini or IIS 7 ) I get "Internet Explorer cannot display the webpage". No server error, not even 404 or 500 error. </p> <p>In stepping through the code I can see that the routes are registered properly during application start up. The contstructor and Initialize method are called on the correct controller then.....nothing. I was able to inspect the requestContext coming into the Initialize method on my controller and the framework has picked up the correct Route Data. This happens with all my controllers. Another MVC project runs just fine on the same machine.</p> <p>I'm completely lost. Any help will be GREATLY appreciated as I have a deadline of Dec 1st on this project.</p> <p>Thanks, Jeff French</p> <p>Here's some of my code:</p> <p>My home controller which doesn't work:</p> <pre><code>public class HomeController : Controller { public HomeController():base() { } protected override void OnException(ExceptionContext filterContext) { base.OnException(filterContext); } protected override void OnActionExecuting(ActionExecutingContext filterContext) { base.OnActionExecuting(filterContext); } protected override void Initialize(System.Web.Routing.RequestContext requestContext) { base.Initialize(requestContext); } protected override void HandleUnknownAction(string actionName) { base.HandleUnknownAction(actionName); } public ActionResult Index() { //if (!Request.IsAuthenticated) // return RedirectToAction("LogOn", "Account"); return View(); } public ActionResult About() { return View(); } } </code></pre> <p>I added the overrides so that I could set breakpoints in them to see what was being called. The contructor is called then the Initialize method. The requestContext passed to the Initialize method contains the correct route data. As soon as the Initailize method finishes executing I get the "Internet Explorer cannot display the webpage" message. </p> <p>My Glogal.asax:</p> <pre><code>public class MvcApplication : HttpApplication { public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "Default", // Route name "{tenant}/{controller}/{action}/{id}", // URL with parameters new {tenant = "demo", controller = "Home", action = "Index", id = ""} // Parameter defaults ); } public void RegisterViewEngines(ViewEngineCollection engines) { } protected void Application_AuthenticateRequest(object sender, EventArgs e) { } protected void Application_Start() { RegisterRoutes(RouteTable.Routes); RegisterViewEngines(ViewEngines.Engines); } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload