خطأ في تشغيل asp.net mvc 2 المشروع من خارج منطقة الجزاء في مقابل 2010

StackOverflow https://stackoverflow.com/questions/1600961

سؤال

أنا خلقت حل جديد وهو يبني بخير استهداف الإطار 4.0 ولكن عند تشغيل هذا المتصفح يأتي قائلا:

لا يمكن العثور على المورد.وصف:HTTP 404.المورد الذي تبحث عنه (أو أحد تبعياتهما) قد أزيلت, تم تغيير اسمها أو غير متوفر مؤقتا.يرجى مراجعة الرابط التالي و تأكد من أنها مكتوبة بشكل صحيح.URL المطلوب:/

أي أفكار حول كيفية تصحيح هذا ؟

هل كانت مفيدة؟

المحلول

حاول إضافة الافتراضي.صفحة aspx الذي يأتي مع asp.net mvc 1.0 قالب المشروع.لدي مشكلة مشابهة تشغيل mvc 2 من خارج منطقة الجزاء على جهاز كمبيوتر مع IIS 5 (XP) و التي لم خدعة.

الافتراضي.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. --%>

الافتراضي.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);
        }
    }
}

نصائح أخرى

أنت لا تحتاج إلى إضافة الافتراضي.صفحة aspx المذكورة أعلاه.

المتصفح سيتم عرض هذا 404 الرسالة إذا قمت بإضافة وتشغيل جديد فارغة ASP.صافي MVC 2 تطبيق "للخروج من مربع".

هذا هو المسار الافتراضي التي يتم تعريفها في العالمية.asax.

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

يمكنك أن ترى أنه يبحث عن تحكم دعا البيت و العمل يسمى مؤشر.

عند إنشاء مجموعة جديدة فارغة المشروع هو ترك لك لإنشاء منزل تحكم مؤشر العمل (فهي غير موجودة في مشروع فارغ) ، ثم إنشاء عرض مؤشر العمل أيضا.

تخميني هو أن تحتاج إلى تسجيل أو تفعيل الإطار IIS.حاول تشغيل aspnet_regiis من الإطار المناسب شجرة و / أو تأكد من أن الإطار المناسب الإصدار هو مسموح به بموجب IIS على ويب ملحقات.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top