Global.asax无法找到代码隐藏类

当我尝试运行我inheritance的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看起来像这样:

Codebehind="Global.asax.cs"添加到Markup文件(Global.asax):

从:

 <%@ Application Inherits="AdminConsole.MvcApplication" Language="C#" %> 

至:

 <%@ Application Codebehind="Global.asax.cs" Inherits="AdminConsole.MvcApplication" Language="C#" %> 

validation项目是否配置为将DLL放入/bin文件夹而不是/bin/x86/Debug/ (或类似)。

我的问题是我不小心创建了一个网站而不是一个Web 应用程序 。 一旦我重新创建了项目,它就运行良好。