让自己有问题,开始在MVC3路由问题...未找到资源 - MVC3
试图在Global.asax
routes.MapRoute(_
"MeGet", _
"me", _
New With {.controller = "MeController", .action = "Show"}, _
New With {.httpMethod = New HttpMethodConstraint("GET")}
)
routes.MapRoute(_
"MePut", _
"me", _
New With {.controller = "MeController", .action = "Update"}, _
New With {.httpMethod = New HttpMethodConstraint("PUT")}
)
这里定义一个简单的路线,我的控制器如下。
Public Class MeController
Inherits System.Web.Mvc.Controller
'
' GET: /me
Public Function Show() As ActionResult
Dim stuff = {"Hello", "World"}
Return Json(stuff, JsonRequestBehavior.AllowGet)
End Function
'
' PUT: /me
Public Function Update() As ActionResult
Return View()
End Function
End Class
而且我得到的是...
的资源不能被发现。
没有堆栈跟踪。
以下建议
更改后的控制器来_me
并试图路由调试
现在说有不匹配!但低于它说,它目前的请求匹配......
更改和错误仍然存在......我假设'_me'是因为'Me'是VB中的一个关键字,我只需单击create controller并将其命名为我。 – jondavidjohn
更改了代码以反映仍然出错的建议。 – jondavidjohn
@jondavidjohn,在你的路线中使用'.controller =“我”而不是'.controller =“MeController”'。你似乎编辑了你最初的问题。 –