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

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

源错误:

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

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

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


当前回答

如果你在同一个解决方案中运行Web和WebApi,如果你不小心忘记将VS解决方案设置为“多个启动项目”,也会发生这种情况。

您可以通过右键单击解决方案资源管理器中的解决方案并选择“属性”来检查这一点。然后寻找“创业项目”。

其他回答

尝试修改全局变量。Asax文件(简单添加一个空格的地方),并重新运行。这将迫使内置的web服务器刷新和重新编译全局。asax文件。

也做一个清理和重建-应该修复问题

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.

我发现在项目中更改命名空间,而没有在整个解决方案中重构它是我的问题。检查你的项目属性,看看你的命名空间是什么,确保排列整齐,全面。

我关闭和重开了视觉工作室,它工作。

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