[ACCEPTED]-Could not load type 'XXX.Global'-visual-studio

Accepted answer
Score: 85

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

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

Score: 57

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

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

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

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

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

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

  • IIS Express is using the wrong 4 root directory (see answer in VS 2012 launching app based on wrong path)

Make sure 3 you close VS after you try them.

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

Score: 5

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

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

Public Class [Global]
    Inherits System.Web.HttpApplication
    ...
Score: 5

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

Score: 3

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

Score: 2

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

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

Score: 2

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

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

Hope this helps someone else!

Score: 2

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

Score: 2

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

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

Score: 1

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

Score: 1

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

See here for more info

Score: 1

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

Score: 1

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

Score: 1

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

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

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

Score: 0

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

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

Score: 0

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

Score: 0

Deletin obj, bin folders and rebuilding 1 fixed my issue

Score: 0

I had this problem.

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

More Related questions