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

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

源错误:

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

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

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


当前回答

这个问题,我解决了给文件夹的正确权限,以及从IIS检查。

当我在本地环境中测试时,我得到了每个人的许可。但是在发布模式下,我认为我们只允许ASP。网用户。

其他回答

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

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

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

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

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

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

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

我是这样解决问题的: 只需修复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.

有两种方法:

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