错误运行asp.net mvc 2项目在vs 2010中开箱即用

leo*_*ora 5 asp.net-mvc visual-studio-2010 asp.net-mvc-2

我创建了一个新的解决方案,它构建了精细的目标框架4.0但是当我运行它时,我的浏览器出现了:

无法找到该资源.说明:HTTP 404.您要查找的资源(或其中一个依赖项)可能已被删除,名称已更改或暂时不可用.请查看以下网址,确保拼写正确.请求的网址:/

关于如何调试这个的任何想法?

Mar*_*ano 5

尝试添加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. --%>
Run Code Online (Sandbox Code Playgroud)

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);
        }
    }
}
Run Code Online (Sandbox Code Playgroud)