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

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

源错误:

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

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

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


当前回答

我的应用程序是在VS的旧版本中构建的,并且没有bin文件夹。我已经将它升级到一个更新的版本,但是在部署它时遇到了一个噩梦。我终于追踪到这个错误的项目>属性>应用程序。目标框架设置为2.0;在服务器上更改它以匹配IIS管理器/应用程序池,为我解决了这个问题。

其他回答

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

I faced the problem in VS 2017 out of no where, took my whole day going through 100 of solutions any of these didnt work. I then took my whole solution and started it on different machine having VS 2017 installation.. IT FINALLY WORKED. Than reinstalled VS 2017 on the original one and it started running on that too. I strongly recommend you try your solution on a different machine before wasting much time to debug it, bcz it is a BUG in VS 2017 as it seemed for me, have reported same to VS TEAM. Hope this helps any one in grief. Cheers.

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

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

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

我有同样的问题,当我有2个实例的Visual Studio运行相同的项目。所以我关闭了两个Visual Studio,只打开了一个实例,它现在工作得很好!