I am experiencing an error that I am unable to resolve for some time now. I was wondering if someone can help identify the cause of this error? I am completely new to asp /
Could not load type
means that a type could not be loaded. (In this case, "type" refers to Inventory1.Global
). Types are located in compiled DLLs. So, either the DLL isn't available, is out of date, or doesn't contain a public
type with the given name.
Some possible causes are:
namespace Inventory1 { public class Global { ... } }
Note: avoid names like Inventory1
. They imply that there is an Inventory2
, Inventory3
, etc., which is bad practice as they're abmiguous and not very descriptive. Also, Global
is pretty vague, and may introduce confusion with the global namespace.
Inventory1
, not INVENTORY1
.)public
. If I had to guess, I'd put my money on a compilation error. Unlike PHP and other interpreted languages, C# have to be successfully compiled before they can be used.
Since it was only happening with IISexpress, changing output from bin\Debug\ to bin\ solved it for me. Changing tag CodeBehind to CodeFile only created even more problems.
This happened with me on my local machine. The issue was incorrect IISExpres config. If you are getting this issue on your local environment (Visual Studio debug runs), check the IIS Express config file. Make sure your local site/application path is pointing to the correct location.
The configuration file is called applicationhost.config
. It's stored here:
My Documents > IIS Express > config . Usually (not always) one of these paths will work:
I tried all the solutions listed above and none of them worked. I finally created a new web page (webform) and copy blocked all the code (cs and aspx files) into it from the old one, deleted the old cs and aspx file, recompiled, and now I'm back in business. I know it makes no sense. It should not have mattered, but it worked.
If you just added the new aspx File, rebuild the project it is located in. The problem comes from your Code Behind file that isn't compiled at the moment, therefore you want to access a newer page that doesn't exist in your current compiled project dll
Parser Error Message: Could not load type __
After doing everything suggested in the comments above, with no luck, refreshing (uploading) the contents of /bin to the server worked. The files uploaded to bin are the: dll, pdb and xml. Don't know which one did it.
The problem I had here was induced by renaming a file (_.aspx) in Solution Explorer.