IIS 7.X에서 asp.net mvc 응용 프로그램을 배포 한 것은 이번이 처음입니다.asp.net mvc 3 페이지를 찾을 수 없습니다.
루트 경로에 응용 프로그램을 배포하면 제대로 작동하지만 아래에서 설명한대로 비 루트 경로에 배포하면 내 홈 페이지 만 작동하지만 다른 링크는 작동하지 않습니다. MyController에와 액션 - - 시켜라을
http://rootpath/MyApplication/
는 이제 컨트롤러가 말할 수 있습니다. 그것의 실행에, 나는 http://rootpath/MyApplication/MyController/MyAction를 기대하고있다. 그러나 그것은 단지 루트 경로를 가리킨다. (현재 출력 - http://rootpath/MyController/MyAction)
기본 라우팅을 변경하지 않았습니다. "File System"옵션을 사용하여 사이트를 게시했습니다.
/////// Code of Global.asax ///////
public class MvcApplication : System.Web.HttpApplication
{
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
filters.Add(new HandleErrorAttribute());
}
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
bool isBypassOn = false;
if (!isBypassOn)
{
//Following should be default application route path
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Login", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
}
else
{
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "ByPassLogin", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
}
}
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
RegisterGlobalFilters(GlobalFilters.Filters);
RegisterRoutes(RouteTable.Routes);
}
}
// 일부 컨트롤러 코드
공용 클래스 MemberHomeController : BaseController { // // GET :/MemberHome/
public ActionResult Index()
{
//return Content("Successful Login...");
return View();
}
public override void Custom_OnLoad()
{
SelectedMenu = Menus.Home;
}
public ActionResult ScheduleIndex()
{
//return Content("Successful Login...");
return View();
}
}
컨트롤러 및 global.asax를 게시하십시오. – kd7