Global.asax parse error after minor change and revert to previous version

前端 未结 4 707
梦如初夏
梦如初夏 2021-02-07 13:21

The project in context is:

  • ASP .NET Web Application
  • .NET Framework: 4
  • Platform Target: x86
  • IDE: Visual Studio 2010 Ultimate SP1
4条回答
  •  无人共我
    2021-02-07 13:44

    Regular ASP.NET Web Application has 2 files in solution folder:

    1. Global.asax
    2. Global.asax.cs

    Make sure that class in Global.asax.cs:

    namespace YourWebAppNamespace
    {
      public class MvcApplication : HttpApplication
      {
         ...
    

    Has the same/right name in Global.asax:

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

    I got an issue with this when I manually changed class name in Global.asax.cs file, so as for result I had the same error as you and from my perspective, it should be more informative. I know that this question already was answered, but maybe my case can be helpful for someone.

提交回复
热议问题