asp.net mvc 3 - Troubleshooting "The resource cannot be found." Error -
i have mvc 3 app few areas built it, 1 of areas admin section of site. working fine. wanted try mvccontrib portable areas make app more modular, installed mvccontrib , after trial , error got couple portable areas , running.
then decided move admin area portable area, created new project , stubbed out admin portable area. had rename local admin area not conflict. while moving code admin pa decided did not want headache of moving telerik , other things had wired admin area. moved things down main project area , deleted admin pa.
i rewired admin area in , went on involved in setting area. life of me cannot of areas in main project load. keep getting "the resource cannot found." error message.
i went far removing reference mvccontrib , portable areas still no luck. @ end of rope not know how debug this. have used custom route handler glimpse neither useful when error thrown.
here route in global.asax
routes.maproute( "default", // route name "{controller}/{action}/{id}", // url parameters new { controller = "home", action = "index", id = urlparameter.optional }, // parameter defaults null, new string[] { "coolproject.web.controllers" } );
here route in admin area registration file
context.maproute( "admin_default", "admin/{controller}/{action}/{id}", new { controller = "home", action = "index", id = urlparameter.optional }, new string[] { "coolproject.web.areas.admin.contollers" } );
here global.asax
public static void registerroutes(routecollection routes) { routes.ignoreroute("{resource}.axd/{*pathinfo}"); routes.maproute( "default", // route name "{controller}/{action}/{id}", // url parameters new { controller = "home", action = "index", id = urlparameter.optional }, // parameter defaults new string[] { "coolproject.web.controllers" } ); } protected void application_start() { arearegistration.registerallareas(); registerglobalfilters(globalfilters.filters); registerroutes(routetable.routes); initializecontainer(); appstart_structuremap.start(); sitemapmanager.sitemaps.register<xmlsitemap>("adminnavigation", sitemap => sitemap.loadfrom("/areas/admin/adminnavigation.sitemap")); }
i have checked setup against similar working site , same exception of namespaces , classes.
i developing on win 7 iis7.5
using glimpse routes plugin can see routes exist problem route in global.axas file taking on requests areas.
what need routes allow core app , areas along? funny thing have production app using areas works fine.
update....
i created new mvc 3 project, added single area named admin. edited adminarearegistration.cs , global.asax files include namespaces in maproute statement, compiled , runs perfectly. can access area no problem.
i compared global.asax , adminarearegistration.cs files in broken project , identical. not issue how set routes, think there problem not seeing.
are calling
arearegistration.registerallareas();
on application_start in global.asax? server using development cassini, iisexpress, iis?
edit after reviewing more detailed information.
in admin area registration file if have code
context.maproute( "admin_default", "admin/{controller}/{action}/{id}", new { controller = "home", action = "index", id = urlparameter.optional }, new string[] { "coolproject.web.areas.admin.contollers" } );
i think there typo in "coolproject.web.areas.admin.contollers" , should "coolproject.web.areas.admin.controllers"?
Comments
Post a Comment