简体   繁体   中英

404 Error with Durandal Starter Kit and Visual Studio

I have just installed the Durandal Starter Kit via Nuget and was hoping to start building Durandal apps using Visual Studio and the MVC framework. I've read a couple of articles and blog posts like this but whenever I try and set up a sample Durandal application I get a 404 error with the browser complaining: ' The resource can't be found. '

I've checked and the Nuget installation has set up DurandalController.cs and deleted the default MVC controller. The project was created as an 'ASP.NET MVC 4 Web Application' using the 'Empty' template. What am I doing wrong?

The problem was that the installation of the Durandal Starter Kit had created a new default controller but hadn't set it as the default route for the project.

To fix it, I navigated to App_Start/RouteConfig.cs and in RegisterRoutes() I changed the default routes.MapRoutefrom:

defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }

to:

defaults: new { controller = "Durandal", action = "Index", id = UrlParameter.Optional }

The application worked straight away after this change.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM