我得到了错误

无法加载类型mvcapapplication

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

如何纠正?


当前回答

我遇到了这个问题,我看到了各种各样的答案,但没有一个被接受。我在一点点之后发现,在尝试运行之前简单地建立网站解决了我的问题。

其他回答

每次我保存一个动态编译的文件(ascx, aspx等)都会遇到这个问题。我等待8-10秒,然后它就消失了。这太烦人了。

我认为这可能是IIS Express问题,所以我在内置的开发服务器中尝试,保存文件后仍然收到它。我正在运行一个MVC应用程序,我也使用T4MVC,也许这是一个因素…

确保你不应该打开MVC项目像File->打开网站使用File->打开项目。

我的解决办法是:因为问题是我制造的!我改变了Global.asax.cs中的命名空间

您还需要更改Global.asax中的Inherits属性值。

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

我已经有bin/在我的构建标签。我是全球化的。Asax从另一个项目的副本,但没有工作。

最终对我有效的解决方案是删除bin/文件夹,并创建一个具有相同名称的新空文件夹。