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

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

源错误:

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

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

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


当前回答

对我来说,解决办法不是以上任何一种。 我必须删除(而不是重新创建)全局。和Global.asax.cs。 这些文件存在于文件夹中,即使它们在项目中没有被引用。 显然那个建筑还看见了他们。 因为我在Startup.cs中使用了OWIN, Global。Asax文件已经过时,删除它没有问题。

其他回答

我只是在一个MVC5应用程序上遇到了这个问题,没有什么对我有用。这发生在我试图将SVN还原到项目的旧版本之后。

我必须删除Global. asax.cs,然后通过右键单击项目->添加新项目-> Global来添加一个新的项目。asax和THAT最终解决了它。

只是觉得也许能帮到别人。

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.

清空bin文件夹。构建所有依赖类库并在主项目中引用它们,然后构建完整的解决方案。

有两种方法:

配置管理器将dll构建显示为'64'和'any cpu'构建的混合。 将它们都放在同一个构建中可以解决这个问题。 在分支之间切换时,IIS快速路径有时不会更新。右键单击任务栏中的“IIS Express”>显示所有应用程序,并验证路径是否指向正确的分支。

重新创建虚拟目录为我解决了这个问题。

(在此之前,我尝试了这里列出的其他建议,如清理解决方案,删除bin文件夹,重建解决方案等。没有一个工作,直到我重新创建虚拟目录)

Debug ->调试属性-> Web ->创建虚拟目录