ASP.NET MVC 4 VB你好世界痛苦

时间:2014-05-31 17:04:42

标签: asp.net-mvc-4

我根本无法获得最基本的MVC 4网站。我已经下载了一个演示版HelloWorld解决方案并且它可以工作,因此IIS方面必须正常工作。我逐个浏览文件并确保它们完全相同,但它仍然没有。请帮忙。

我收到此错误:

Server Error in '/' Application.

The resource cannot be found.

Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly. 

我的RouteConfig.vb看起来像这样:

Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Web
Imports System.Web.Mvc
Imports System.Web.Routing

Public Class RouteConfig
    Public Shared Sub RegisterRoutes(ByVal routes As RouteCollection)
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}")

        routes.MapRoute( _
            name:="Default", _
            url:="", _
            defaults:=New With {.controller = "HomeController", .action = "Index"} _
        )
    End Sub
End Class

和我的HomeController.vb看起来像这样:

Namespace re**********el
    Public Class HomeController
        Inherits System.Web.Mvc.Controller

        Function Index() As ActionResult
            Return View()
        End Function

    End Class
End Namespace

我的Index.vbhtml看起来像这样:

@Code
    ViewData("Title") = "Index"
End Code

<h2>Index</h2>

整个文件夹集如下所示:

Folder Set

1 个答案:

答案 0 :(得分:0)

我真是个傻瓜。

其他人:

defaults:=New With {.controller = "HomeController", .action = "Index"} _

需要:

defaults:=New With {.controller = "Home", .action = "Index"} _