I am trying to deploy my web project and I keep getting this error:
Line 1: <%@ Application Codebehind=“Global.asax.cs” Inherits=“nadeem.MvcApplication” Language=“C#” %>
I looked at this post: Parser Error: Server Error in '/' Application
But it is currect in my project.
I suspect it something with my iis7 configuration.
Any ideas?
Global.asax:
<%@ Application Codebehind="Global.asax.cs" Inherits="tamal.pelecard.biz.MvcApplication" Language="C#" %>
Global.asax.cs:
namespace TamalTest
{
using System;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
public class MvcApplication : HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
RegisterGlobalFilters(GlobalFilters.Filters);
RegisterRoutes(RouteTable.Routes);
}
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
filters.Add(new HandleErrorAttribute());
}
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
}
}
}
Solved, just renamed the Global.asax or delete it fixed the problem :/
Other known related bugs I found on the web:
HttpApplication -> public class MvcApplication : HttpApplication
You can change it by editing Global.asax file (not Global.asax.cs). Find it in app folder in windows explorer then edit
<%@ Application Codebehind="Global.asax.cs" Inherits="YourAppName.Global" Language="C#" %>
to
<%@ Application Codebehind="Global.asax" Inherits="YourAppName.MvcApplication" Language="C#" %>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With