简体   繁体   English

Durandal入门套件和Visual Studio出现404错误

[英]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. 我刚刚通过Nuget安装了Durandal入门套件 ,并希望开始使用Visual Studio和MVC框架构建Durandal应用程序。 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. 我读了几篇文章和博客帖子喜欢这样 ,但每当我试图建立一个示例应用程序迪朗达尔我得到一个404错误与浏览器抱怨:“ The resource can't be found. ' '

I've checked and the Nuget installation has set up DurandalController.cs and deleted the default MVC controller. 我已经检查过,并且Nuget安装已经设置了DurandalController.cs并删除了默认的MVC控制器。 The project was created as an 'ASP.NET MVC 4 Web Application' using the 'Empty' template. 使用“空”模板将项目创建为“ ASP.NET MVC 4 Web应用程序”。 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. 问题在于Durandal Starter Kit的安装创建了一个新的默认控制器,但没有将其设置为项目的默认路径。

To fix it, I navigated to App_Start/RouteConfig.cs and in RegisterRoutes() I changed the default routes.MapRoutefrom: 为了修复它,我导航到App_Start/RouteConfig.cs并在RegisterRoutes()更改了默认路由。

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. 更改后,应用程序立即工作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Visual Studio 2010 ///.NET MVC应用程序-空白项目出现404错误 - Visual Studio 2010 //.NET MVC Application - 404 Error on blank project ASP.NET MVC入门项目出现404错误 - Getting 404 error with ASP.NET MVC starter project ASP.Net MVC 4未注册的区域。 Visual Studio 2012中的HTTP 404错误 - ASP.Net MVC 4 Areas not registering. HTTP 404 error from Visual Studio 2012 Visual Studio ASP.NET Web部署-引用自定义库的每个页面都显示错误404 - Visual Studio ASP.NET Web deploy - Every pages referencing a custom libraries are giving an Error 404 使用Visual Studio 2017在Azure应用服务中发布ASP.NET应用程序后获取HTTP错误404 - Getting HTTP ERROR 404 after publishing ASP.NET application in Azure App Service with Visual Studio 2017 在Visual Studio上运行网站项目在本地失败,无法通过http 404找到页面错误 - run a website project on visual studio failed in local by http 404 not found page error MVC .NET ASP的社交入门套件 - social starter kit for mvc .net asp Asp.net MVC成员资格入门套件 - Asp.net MVC Membership starter kit Visual Studio ASP.NET MVC项目启动器页面显示完整的URL - Visual Studio asp.net mvc project starter page shows complete url ASP.NET MVC 应用程序在 IIS 中给出 404 错误,但是相同代码库的不同分支可以工作,我可以在 Visual Studio 中运行它 - ASP.NET MVC app gives a 404 error in IIS, but a different fork of the same codebase works, and I can run it in Visual Studio
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM