I have an mvc 2 application that is running in ii6 in the test environment and production server.
The test enviroment runs just fine, but after moving to production all pages except the home page server up 404 errors.
I have followed step 2, here: http://blog.codeville.net/2008/07/04/options-for-deploying-aspnet-mvc-to-iis-6/ and added a .aspx extension to the route, and have tried the wildcard mapping. It doesn't appear to make any difference.
I put the diagnostic file found here: http://bradwilson.typepad.com/blog/2010/03/diagnosing-aspnet-mvc-problems.html into the directory and loaded it, but it does not report any errors or problems.
I even wiped the test server and reinstalled the app from scractch, setup the wildcard mapping and it worked fine.
Right now the pages are being routed like: Home.aspx/About
and my routing table looks like this:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.IgnoreRoute("{*favicon}", new { favicon = @"(.*/)?favicon.ico(/.*)?" });
routes.MapRoute(
"Default", // Route name
"{controller}.aspx/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
routes.MapRoute(
"NewEmployee",
"{controller}.aspx/{action}",
new { controller = "NewEmployee", action = "Index" }
);
routes.MapRoute(
"Admin",
"{controller}.aspx/{action}",
new { controller = "Admin", action = "Index" });
routes.MapRoute(
"AccessMaster",
"{controller}.aspx/{action}/{id}/{subid}",
new { controller = "AccessMaster", action = "Index", id=UrlParameter.Optional,subid=UrlParameter.Optional });
routes.MapRoute(
"Root",
"",
new { controller = "Home", action = "Index", id = "" }
);
}
I'm at a loss here. Am I doing something wr开发者_JS百科ong? Is there something wrong with the server?
Try registering ASP.NET with IIS using the following command:
aspnet_regiis /i
Also make sure that you have enabled the correct version of ASP.NET in IIS (Web Service Extensions folder):
You also have many unnecessary routes routes. For example the NewEmployee
and Admin
routes are totally equivalent meaning that only the first route in this list will ever be matched. But that's another problem, it is unrelated to the deployment errors you are getting. You could fix your routes once you make your application successfully run.
It looks like deleting and recreating the virtual directory magically fixed whatever was wrong with it.
精彩评论