I know this error has popped up for people before, but this seems to be a bit of a special case.
I've been working on setting up a SPA with ReactJS on top of ASP.NET MVC 4. I've had no problem getting things working on my machine. However, the weird issue I'm seeing is that it's not working on any other machines for other devs. As far as I've seen, I don't have any files that aren't checked in under source control. I've made use of the RouteDebugger and I see the proper route being caught.
The route I'm using for this SPA is /V2/Home. So I have an Area called "V2", an MVC controller in the area called "HomeController" and it has a view called "Index". I setup a catchall in the V2AreaRegistration.
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"V2_default",
"V2/{*url}",
new { area = "V2", controller = "Home", action = "Index" }
);
}
Here's Application_Start in Global.asax.cs
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
GlobalConfiguration.Configure(WebApiConfig.Register);
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
AuthConfig.RegisterAuth();
AutoMapperConfiguration.Configure();
Logger.Info("Application started");
GlobalConfiguration.Configuration.EnsureInitialized();
}
I've gotten absolutely nowhere with this. I would love to get this solved. Feel free to ask for anything missing.
I'm not sure exactly what it is, but I managed to fix my issue. It has something to do with how we're handling routing and authentication/permissions.
I can't explain how this would work on your machine, but not your colleagues machines.
It looks like your area registration doesn't know what namespace your controllers live in. Try adding a 4th argument to the MapRoute
method call that declares the namespace of your new controllers:
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"V2_default",
"V2/{*url}",
new { area = "V2", controller = "Home", action = "Index" },
new string[] { "MyApplication.MyMvcProject.Areas.Controllers" } // Change this to the namespace of your area controllers.
);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With