기본 경로 이외의 것에 액세스 할 때 오류
-
03-07-2019 - |
문제
모노에서 일하기 위해 라우팅을하는 데 어려움이 있습니다. 기본 경로는 잘 작동하지만 다른 것은 없습니다.
이것들은 내가 설정 한 경로입니다.
routes.MapRoute(
"HelloRoute",
"Hello/{name}",
new { controller = "Home", action = "Hello" }
);
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = "" }
);
그리고 내 홈 컨트롤러에는 해당 조치가 있습니다.
public ActionResult Index ()
{
ViewData["Message"] = "Welcome to ASP.NET MVC on Mono!";
return View ();
}
public ActionResult Hello(string name)
{
ViewData["Message"] = "hello "+name;
return View ();
}
이제 내가 탐색한다면 http : // localhost/ 오신 것을 환영하는 메시지를받습니다 ...하지만 내가 가면 http : // localhost/hello/world 오류가 발생합니다.
value name controller does not match any of the values.
설명 : HTTP 500. 오류 처리 요청.
스택 추적 :
System.InValidOperationException : 값 이름 컨트롤러는 값과 일치하지 않습니다. at System.Web.routing.routedata.getRequiredString (System.String valuename) [0x00000]에서 System.web.mvc.mvchandler.processrequest (system.web.httpcontextbase httpcontext) [0x00000] at System.MvC.MvVCHANDLER. (system.web.httpcontext httpcontext) [0x00000]에서 system.web.httpapplication.tick () [0x00000
내가 분명히 잘못한 일을하고 있습니까?
aditional 경로와는 별도로 행동 및보기 이것은 Monodevelop에서 생성 된 표준 ASP.NET MVC 프로젝트입니다.
해결책 2
이것은 모노 라우팅 구현의 버그라는 것이 밝혀졌습니다.
여기에 버그 보고서를 작성했습니다. https://bugzilla.novell.com/show_bug.cgi?id=500739. 그리고 아직 시도하지는 않았지만 이제는 고정되었습니다.
다른 팁
댓글 섹션에 제안 된대로 asp.net MVC 템플릿의 버그처럼 보입니다. 게시하다.