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

萝らか妹 提交于 2019-12-03 11:10:01
Sain Pradeep

Cleaning the solution and deleting the assemblies made no difference to subsequent builds. My solution was to just change the output path in project settings for the web app to Bin (rather than bin/x86/Debug).

Source:- "Could not load type [Namespace].Global" causing me grief

we had a similar issue here.

and what we did was just to close the IDE. and open it again, and then build, then run.

pretty frustrating and confusing.

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.

GoAntonio
  • using Notepad, edit your Global.asax file to make sure it inherits from your web app's namespace
  • check the project properties for its assembly name and default namespace
  • delete your old assemblies from the bin directory (old project assemblies can cause problems!)

    good luck!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!