[英]Visual Studio 2010 //.NET MVC Application - 404 Error on blank project
[英]404 Error with Durandal Starter Kit and Visual Studio
我剛剛通過Nuget安裝了Durandal入門套件 ,並希望開始使用Visual Studio和MVC框架構建Durandal應用程序。 我讀了幾篇文章和博客帖子喜歡這樣 ,但每當我試圖建立一個示例應用程序迪朗達爾我得到一個404錯誤與瀏覽器抱怨:“ The resource can't be found.
'
我已經檢查過,並且Nuget安裝已經設置了DurandalController.cs
並刪除了默認的MVC控制器。 使用“空”模板將項目創建為“ ASP.NET MVC 4 Web應用程序”。 我究竟做錯了什么?
問題在於Durandal Starter Kit的安裝創建了一個新的默認控制器,但沒有將其設置為項目的默認路徑。
為了修復它,我導航到App_Start/RouteConfig.cs
並在RegisterRoutes()
更改了默認路由。
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
至:
defaults: new { controller = "Durandal", action = "Index", id = UrlParameter.Optional }
更改后,應用程序立即工作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.