我得到了错误

无法加载类型mvcapapplication

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

如何纠正?


当前回答

如果您的IIS Express拥有/正在使用相同的端口分配托管旧的/不同的项目,则在visual studio中运行项目时也会发生这种情况。

若要修复此问题,您可以更改此项目的端口分配或关闭IIS Express。

其他回答

我的问题是我还没有建立这个项目(糟糕)。不知道这是否真的有助于任何人,但只是确保你在点击链接之前构建一切。

尽管听起来很傻,但我尝试了所有的方法,它都不工作,最后重新启动VS2012,看到它又工作了。

右键单击正在失败的解决方案中的项目。 卸载项目 重新加载项目 建设项目 重建方案

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项目的程序集不可用,你会得到这个错误。但这可能是一个常见的场景,特别是因为您实际上编译了您的解决方案——项目只是没有得到构建。

确保global.asax.cs中的命名空间与你的webapp的命名空间匹配