【发布时间】:2011-11-02 19:28:54
【问题描述】:
在开始使用 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 并尝试了路由调试器
现在它说 NO MATCH! 但下面说它与当前请求匹配...
【问题讨论】:
标签: vb.net json asp.net-mvc-3 rest routing