2

I had my site working with the following route, but I needed to fork a new version of the site that didn't need the DB parameter. I removed the DB portion, and published to a new IIS virtual directory, and it just loads. It never stops loading.

Here's the route before:

routes.MapRoute(
    "Default", // Route name
    "{db}/{controller}/{action}/{id}", // URL with parameters
    new { db = "Home", controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);

And here's after:

routes.MapRoute(
    "Default", // Route name
    "{controller}/{action}/{id}", // URL with parameters
    new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);

That's the only thing I changed in Global.asax.cs. In my controllers, I removed the parameter from my methods: public ActionResult Index(string db) became public ActionResult Index().

Everything works great in Cassini (I think it's called, the local hosting when debugging in VS 2012). However, when I deploy to the webserver, it loads infinitely.

Any ideas?

EDIT: Even when my /Home/Index is as follows, it still loads forever:

    [HttpGet]
    public string Index()
    {
        return "Hello, World!";
        //var dc = BuildDC();
        //ViewBag.Title = "Log in";

        //// Check for cookie that stores Booth Number and Vendors
        //if (HttpContext.Request.Cookies["BoothNumber"] != null && HttpContext.Request.Cookies["Vendors"] != null)
        //{
        //    // We have cookie. Resume session, then.
        //    Session["BoothNumber"] = HttpContext.Request.Cookies["BoothNumber"];
        //    Session["Vendors"] = HttpContext.Request.Cookies["Vendors"];

        //    return RedirectToAction("Login", "Show");
        //}
        //else
        //{
        //    // We no have cookie. Let's do setup process, then.
        //    return RedirectToAction("Setup", "Home");
        //}
    }

The important distinction is that if I debug within VS2012, it runs fine. When I deploy, however, it loads forever. I also feel that this isn't simply an IIS question, as when I changed the route -- I broke it. Thanks!

2
  • 1
    Well, what does your index page do? That's probably where the problem is, and you haven't shown us it. Also, do you have any other routes? Commented Jun 6, 2013 at 15:50
  • @MystereMan -- See edit for index method. Thanks! Commented Jun 6, 2013 at 16:02

1 Answer 1

2

Your route is fine. It is likely the case that your Index method on your HomeController either: does something infinitely, redirects to the same route infinitely, or runs a long-running external call synchronously like a DB select that takes minutes.

Break it down to a base case and have your Index method simply return a View that says "Hello World", then go from there.

Sign up to request clarification or add additional context in comments.

4 Comments

I edited my /Home/Index method to return a string that says "Hello, World!" and it works grand when debugging. Not at all when deploying, though. Still the infinite load. Any more suggestoins?
Instead of publishing to an IIS virtual directory, try publishing to a new Site in IIS and stopping the old one, as a test.
Another option is to insert a more specific route for Home/Index and see if that works / you get a 404 / etc.
I marked this answer as correct as it led me to the answer. The real answer was that my IIS was misbehaving. I can't say how, exactly, but after a few more things didn't work I rebooted the whole server and it worked. Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.