我得到了错误

无法加载类型mvcapapplication

当我试图运行我的网站时。

如何纠正?


当前回答

In some circumstances, new projects you create are not by default set to build. If you right-click on your solution, choose Properties, and choose the Configuration Properties | Configuration node on the left and ensure your project has a checkmark under the Build column. In normal circumstances I've found this happens by default. In other circumstances (I happen to have a somewhat complex Web Api / Xamarin Android and iOS / Mvc 5 solution that exhibits this behavior) the checkmark isn't present.

这与其他答案相关——如果你的web项目的程序集不可用,你会得到这个错误。但这可能是一个常见的场景,特别是因为您实际上编译了您的解决方案——项目只是没有得到构建。

其他回答

我有同样的问题,解决它与以下步骤

转到项目属性 在“Build”选项卡上,将输出路径设置为“bin\”

我尝试了很多建议,但对我有效的是使用Visual studio的“发布”功能(在Build选项卡中)。我只是使用FTP部署选项将比特与我的FTP信用一起发送到我的服务器。然后我将IIS指向该目录。当然,要检查应用程序池中是否有正确的框架。

如果更改名称空间,这种情况可能经常发生。返回名称空间的名称,就像它以前一样,这应该可以工作!

[摘自问题]

如果你得到这个错误:“无法加载类型MvcApplication”,查看你的项目的输出路径,并确保它被设置为“bin\”。问题是AspNetCompiler无法找到不在默认位置的文件。

更改输出文件夹的另一个副作用是,您将无法调试代码,并且会出现一条消息,说无法找到程序集信息。

我刚遇到ASP的问题。NET MVC Web API项目,没有一个解决方案做到了戏法。

我重新启动机器,设法解决了这个问题。我升级了Visual Studio 2013,不需要重新启动,但这可能是导致问题的原因。