当我尝试运行我继承的 Web 应用程序时,我不断收到此错误。它是在 2010 年为 C# 3.5 编写的,并使用 Mvc 2。我已经安装了必要的库,但出现了此错误。
错误1 无法加载类型
'AdminConsole.MvcApplication'。 C:\path\to\my\app\Global.asax 1
Global.asax.cs 看起来像这样:
using System.Web.Mvc;
using System.Web.Routing;
namespace AdminConsole
{
// Note: For instructions on enabling IIS6 or IIS7 classic mode,
// visit http://go.microsoft.com/?LinkId=9394801
public class MvcApplication : System.Web.HttpApplication
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default", // Route name
"{controller}.aspx/{action}/{id}", // URL with parameters
new { controller = "Entitlement", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
}
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
RegisterRoutes(RouteTable.Routes);
}
}
}
Global.asax 看起来像这样:<%@ Application Inherits="AdminConsole.MvcApplication" Language="C#" %>
Add Codebehind="Global.asax.cs"
to the Markup
文件(Global.asax):
From:
<%@ Application Inherits="AdminConsole.MvcApplication" Language="C#" %>
To:
<%@ Application Codebehind="Global.asax.cs"
Inherits="AdminConsole.MvcApplication" Language="C#" %>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)