3
votes

I am using the default "ASP.NET MVC 2 Web Application" on IIS (which I have no admin access to) and while I can navigate to

"server/ITEC"

I can't navigate to "server/ITEC/About" without the server returning an error - a 404 error.

I'm also using RouteDebugger for testing - when I use the default "server/ITEC" it matches (aka the default home/index controller action) but when I manually type in "server/ITEC/About" I don't even see the RouteDebugger page. Also, of note, when I place an "index.html" file in "server/Itec/About" it returns the results, which leads me to believe that the directory is configured to use the file system and not MVC routing when handling requests - is this a safe assumption?

How do I update my Global.asax file so that I can return the non-default controllers/actions? Or is this a server issue and how do I go about fixing that?

Thanks!

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace mikeProg
{
    // Note: For instructions on enabling IIS6 or IIS7 classic mode,
    // visit http://go.microsoft.com/?LinkId=9394801

    public class MvcApplication : System.Web.HttpApplication
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");           

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

            RouteDebug.RouteDebugger.RewriteRoutesForTesting(RouteTable.Routes);

        }

        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            RegisterRoutes(RouteTable.Routes);
        }
    }
}
1
Are you deploying your web.config? Without admin rights, do you have a way to see what config you are deploying?Dave Alperovich
What does your controller code look like?Nathan
Also, what version of IIS are you using?Nathan
using IIS7. Yes, I am also deploying web.config - it is the default MVC2 webconfig that is generated when selecting "File>New Project>ASP.NET MVC 2 Web Application". The Controller code is also the default auto-generated code, it returns the right view in localhost, but when deploying to IIS7, it gives me 404 errors for anything other than "server/itec" - for example "server/itec/about" returns a 404 error.TryingReallyHardToDoBetter
I'm sorry, this is on IIS 6 not 7TryingReallyHardToDoBetter

1 Answers

1
votes

I figured this out!

On the Wildcard application maps section for aspnet_isapi.dll the checkbox for

"Verify that file exists" was checked.

Once I asked the System Administrator to uncheck it everything routed perfectly.

Why is this even an option??? when would I use it?