문제

새로운 솔루션을 만들었고 미세한 타겟팅 프레임 워크 4.0을 구축하지만 실행하면 브라우저가 다음과 같습니다.

리소스를 찾을수 없습니다. 설명 : HTTP 404. 귀하가 찾고있는 자원 (또는 그 종속성 중 하나)을 제거하거나 이름이 변경되었거나 일시적으로 사용할 수 없었을 수 있습니다. 다음 URL을 검토하고 철자가 정확한지 확인하십시오. 요청 된 URL : /

이것을 디버깅하는 방법에 대한 아이디어가 있습니까?

도움이 되었습니까?

해결책

ASP.NET MVC 1.0 프로젝트 템플릿과 함께 제공되는 Default.aspx 페이지를 추가하십시오. IIS 5 (XP)가있는 컴퓨터에서 상자에서 MVC 2를 실행하는 비슷한 문제가 있었는데, 이는 트릭을 수행했습니다.

default.aspx :

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="YourNamespace.Website.Default" %>

<%-- Please do not delete this file. It is used to ensure that ASP.NET MVC is activated by IIS when a user makes a "/" request to the server. --%>

default.aspx.cs :

using System.Web;
using System.Web.Mvc;
using System.Web.UI;

namespace YourNamespace.Website
{
    public partial class Default : Page
    {
        public void Page_Load(object sender, System.EventArgs e)
        {
            // Change the current path so that the Routing handler can correctly interpret
            // the request, then restore the original path so that the OutputCache module
            // can correctly process the response (if caching is enabled).
            string originalPath = Request.Path;
            HttpContext.Current.RewritePath(Request.ApplicationPath, false);
            IHttpHandler httpHandler = new MvcHttpHandler();
            httpHandler.ProcessRequest(HttpContext.Current);
            HttpContext.Current.RewritePath(originalPath, false);
        }
    }
}

다른 팁

위에서 설명한 Default.aspx 페이지를 추가 할 필요가 없습니다.

브라우저는 새로운 것을 추가하고 실행하면이 404 메시지를 표시합니다. 비어 있는 ASP.NET MVC 2 응용 프로그램 "상자에서".

이는 Global.asax에 정의 된 기본 경로 때문입니다.

routes.MapRoute(
            "Default", // Route name
            "{controller}/{action}/{id}", // URL with parameters
            new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
        );

Home이라는 컨트롤러와 Index라는 조치를 찾고 있음을 알 수 있습니다.

새로운 것을 만들 때 비어 있는 프로젝트 홈 컨트롤러 및 색인 조치를 만드는 것이 당신에게 남겨졌습니다 (그들은 빈 프로젝트에 없습니다), 그런 다음 인덱스 동작에 대한보기도 만듭니다.

제 생각에는 IIS에 따라 프레임 워크를 다시 등록하거나 활성화해야합니다. 적절한 프레임 워크 트리에서 aspnet_regiis를 실행하거나 IIS 웹 확장에 따라 적절한 프레임 워크 버전이 허용되는지 확인하십시오.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top