我在一个MVC3项目上工作,收到以下错误:

解析器错误信息:无法加载类型“GodsCreationTaxidermy.MvcApplication”。

源错误:

第1行:<%@ Application Codebehind="Global.asax.cs" Inherits="GodsCreationTaxidermy.Core. core . "MvcApplication" Language=" c# " %>

我得到的错误是无法加载GodsCreationTaxidermy.Core.MvcApplication,但在这个屏幕截图中,核心部分没有显示在错误中:

有人对这个错误有什么想法或解决方案吗?


当前回答

您还可以在IIS中检查站点的属性。(在IIS中,右键单击站点,选择“属性”。)确保物理路径设置指向您的应用程序的正确路径,而不是其他应用程序。(这为我解决了这个错误。)

其他回答

从解决方案根目录中删除.vs目录。清洁。重建。

这个问题有时会让我发疯,我不可避免地会在这里翻找答案。我怀疑有多种原因可以产生这种异常,这一次为我工作。

无法加载项目的错误 首先修复你的错误,重建项目后,它的工作

我也面临着同样的问题。尽管遵循每一个答案,它没有工作。 然后我将“Inherits=namespace.class”更改为“Inherits=完全限定的组装名”,即“Inherits=namespace.class,assemblyname, Version=, Culture=, PublicKeyToken=” 希望能有所帮助。

Yes, I read all the answers. However, if you are me and have been pulling out all of what's left of your hair, then try checking the \bin folder. Like most proj files might have several configurations grouped under the XML element PropertyGroup, then I changed the OutputPath value from 'bin\Debug' to remove the '\Debug' part and Rebuild. This placed the files in the \bin folder allowing the Express IIS to find and load the build. I am left wondering what is the correct way to manage these different builds so that a local debug deploy is able to find and load the target environment.

您的本地web服务器运行的代码与您实际使用的代码不同。确保你已经停止调试,停止你的本地web服务器,按照Peter的建议清理和重建,仔细检查你的全局。Asax和global.asax.cs,再试一次。

如果这不起作用,并且您使用的是本地IIS,请尝试在IIS管理器中删除站点并手动重新创建它。