我创建了一个新的解决方案,它可以构建良好的定位框架4.0,但是当我运行它时,我的浏览器显示:

找不到资源。
说明:HTTP404。您正在寻找的资源(或其依赖项之一)可能已被删除,名称更改或暂时不可用。请查看以下网址,并确保其拼写正确。
要求的网址:/


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

最佳答案

尝试添加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);
        }
    }
}

关于asp.net-mvc - vs 2010中开箱即用运行asp.net mvc 2项目时出错,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/1600961/

10-11 22:38
查看更多