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

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

源错误:

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

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

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


当前回答

我是这样解决问题的: 只需修复Global.asax中的命名空间。

其他回答

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

如果在全局变量之后更改名称空间信息(项目或类级别),有时会发生这种情况。生成Asax。

右键单击全局。asax文件,选择“打开”,然后选择“XML(文本)编辑器与编码”(其他编辑器也可以工作,但这是我使用的)。

然后编辑XML指令中的“Inherits”部分

<%MvcApplication" Language " ="C " %>)

以便它与应用程序类的实际全名相匹配。就是这样。

另一种选择是从Global.asax.cs中复制所有代码,然后删除并创建另一个Global。asax文件(然后将代码复制回Global.asax.cs)。

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.

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

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

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

检查项目输出路径(项目属性/ Build)设置为bin而不是bin\Release或bin\Debug

由于某些原因,IIS (VS开发服务器或本地IIS)总是从bin目录访问库(并且不会查找子目录)