Could not load type 'XXX.Global'

asp.netVisual Studio

asp.net Problem Overview


Migrating a project from ASP.NET 1.1 to ASP.NET 2.0 and I keep hitting this error.

I don't actually need Global because I am not adding anything to it, but after I remove it I get more errors.

asp.net Solutions


Solution 1 - asp.net

The reason I encounter this issue is because I change the build configuration. When I set a web project to x86, it changes the output path to bin\x86\Debug. However, the output path should be bin and the web server won't find the binaries because of this.

The solution thus is to change the output path of the website back to bin after you change the build configuration.

Solution 2 - asp.net

There are a few things you can try with this, seems to happen alot and the solution varies for everyone it seems.

  • If you are still using the IIS virtual directory make sure its pointed to the correct directory and also check the ASP.NET version it is set to, make sure it is set to ASP.NET 2.0.

  • Clear out your bin/debug/obj all of them. Do a Clean solution and then a Build Solution.

  • Check your project file in a text editor and make sure where its looking for the global file is correct, sometimes it doesnt change the directory.

  • Remove the global from the solution and add it back after saving and closing. make sure all the script tags in the ASPX file point to the correct one after.

  • You can try running the Convert to Web Application tool, that redoes all of the code and project files.

  • IIS Express is using the wrong root directory (see answer in https://stackoverflow.com/questions/15818364/vs-2012-launching-app-based-on-wrong-path)

Make sure you close VS after you try them.

Those are some things I know to try. Hope one of them works for you.

Solution 3 - asp.net

I've found that it happens when the Global.asax.(vb|cs) wasn't converted to a partial class properly.

Quickest solution is to surround the class name 'Global' with [square brackets] like so (in VB.Net):

Public Class [Global]
    Inherits System.Web.HttpApplication
    ...

Solution 4 - asp.net

Deleting the existing global.asax file and adding a new one, clears out this error. This has worked for me many times.

Solution 5 - asp.net

If your using visual studio 2010 this error can occur when you change the configuration deployment type. The 3 types are x86, x64 and Mixed mode. Changing to mixed mode setting for all projects in solution should resolve the issue. Don't forget to delete the bin, Lib files and change the tempdirectory output if your an ASP.NET website.

Solution 6 - asp.net

This just happened to me and after trying everything else, I just happened to notice on the error message that the app pool was set to .Net 1.1. I upgraded the app to 2.0, converted to web application, but never changed the app pool:

Version Information: Microsoft .NET Framework Version:1.1.4322.2490; ASP.NET Version:1.1.4322.2494

Solution 7 - asp.net

This one drove me completely insane and I couldn't find anything helpful to solve it. This is probably not the reason most people have this issue but I just hope that someone else will benefit from this answer.

What caused my problem was a <clear /> statement in the <assemblies> config section. I had added this because in production it had been required because there were multiple unrelated applications on the same hosting plan and I didn't want any of them to be affected by others. The more correct solution would have been to have just used web config transforms on publish.

Hope this helps someone else!

Solution 8 - asp.net

Changing the address's port number (localhost:) worked for me :)

Solution 9 - asp.net

I fixed this error by simply switching from Debug to Release, launch program (It worked on release), then switch back to Debug.

I tried just about everything else, including restarting Visual Studio and nothing worked.

Solution 10 - asp.net

I had this same problem installing my app to a server. It ended up being the installer project, it wasn't installing all the files needed to run the web app. I tried to figure out where it was broken but in the end I had to revert the project to the previous version to fix it. Hope this helps someone...

Solution 11 - asp.net

In my case, a AfterBuild target in the project to compile the web application was the reason for this error.

See here for more info

Solution 12 - asp.net

Removing Language="c#" in global.asax file resolved the issue for me.

Solution 13 - asp.net

In my case, I was duplicating an online site locally and getting this error locally in Utildev Cassini for asp.net 2.0. It turned out that I copied only global.asax locally and didn't copy the App_code conterpart of it. Copying it fixed the problem.

Solution 14 - asp.net

When you try to access the Microsoft Dynamics NAV Web client, you get the following error. Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 This error can occur when there are multiple versions of the .NET Framework on the computer that is running IIS, and IIS was installed after .NET Framework 4.0 or before the Service Model in Windows Communication Foundation was registered.

For Windows 7 and Windows Server 2008, use the ASP.NET IIS Registration Tool (aspnet_regiis.exe,) to register the correct version of ASP.NET. For more information about the aspnet_regiis.exe, see ASP.NET IIS Registration Tool at Microsoft web site.

try this solution https://www.youtube.com/watch?v=LNwpNqgX7qw

Solution 15 - asp.net

Ensure compiled dll of your project placed in proper bin folder.

In my case, when i have changed the compiled directory of our subproject to bin folder of our main project, it worked.

Solution 16 - asp.net

Had this error in my case I was renaming the application. I changed the name of the Project and the name of the class but neglected to change the "Assembly Name" or "Root namespace" in the "My Project" or project properties.

Solution 17 - asp.net

Deletin obj, bin folders and rebuilding fixed my issue

Solution 18 - asp.net

I had this problem.

I solved it with this solution, by giving CREATOR OWNER full rights to the Windows Temp folder. For some reason, that user had no rights at all assigned. Maybe because some time ago I ran Combofix on my computer.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionBrian GView Question on Stackoverflow
Solution 1 - asp.netPieter van GinkelView Answer on Stackoverflow
Solution 2 - asp.netpete blairView Answer on Stackoverflow
Solution 3 - asp.netMark GlorieView Answer on Stackoverflow
Solution 4 - asp.netuser1444662View Answer on Stackoverflow
Solution 5 - asp.netbhrionnView Answer on Stackoverflow
Solution 6 - asp.netDoug LampeView Answer on Stackoverflow
Solution 7 - asp.netMitchellKrenzView Answer on Stackoverflow
Solution 8 - asp.netrebulanyumView Answer on Stackoverflow
Solution 9 - asp.netfixView Answer on Stackoverflow
Solution 10 - asp.netcampoView Answer on Stackoverflow
Solution 11 - asp.netMichelZView Answer on Stackoverflow
Solution 12 - asp.netmahesh reddyView Answer on Stackoverflow
Solution 13 - asp.netuser173399View Answer on Stackoverflow
Solution 14 - asp.netEng.BasselView Answer on Stackoverflow
Solution 15 - asp.netDevendra PatelView Answer on Stackoverflow
Solution 16 - asp.netascrivenView Answer on Stackoverflow
Solution 17 - asp.netcahit beyazView Answer on Stackoverflow
Solution 18 - asp.netbgmCoderView Answer on Stackoverflow