我簡單的Web應用程序與1個默認路由:ASP.NET MVC默認勞斯是錯誤的
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Game", action = "Index", id = UrlParameter.Optional }
);
我控制器包含以下操作:
public class GameController : Controller
{
public ActionResult Index()
{
// some actions
return View();
}
[HttpPost]
public ActionResult CreateGame(Game game, User user)
{
// some actions
return View("Game");
}
[HttpPost]
public ActionResult JoinGame(User user)
{
// some actions
return View("Game");
}
}
此外,根據查看/ GAME文件夾我「索引」和「遊戲」視圖。 但是,當我從時間開始應用時間(不總是!),它要求
http://localhost:55815/Game/Game
,而不是
http://localhost:55815 or http://localhost:55815/Game/Index
好吧,我在腦海裏有一件事 - OMG!嚴重!我調試了幾個小時! &%$#^ @ $#$#*%$(^(^%... grrrrr 非常感謝! – 2015-04-03 13:51:20