我得到了错误

无法加载类型mvcapapplication

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

如何纠正?


当前回答

我得到这个错误是因为我正在运行项目,尽管有一些编译时错误。这一点我没有注意到。

其他回答

你必须检查action方法,在调用重载实参或无效实参的方法时,是否有一个或多个方法

public string test(string a, string b){

}

public ActionResult x(){
     test(a) //test is need two arguments
}

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

在过去的十年里,我已经见过很多次了,现在又一次。有许多问题都会导致同样的错误。

一个原因是文件的重命名。如果您使用的是.cshtml文件,请检查这些文件和Views\web中的所有名称空间。配置文件。对于web表单,重命名为Default。Aspx(相关的.cs和设计器文件将自动重命名)。代码更改了,但是标记中的Inherits行没有更改。手动更改。仔细检查设计师页面。有时(VS2005-8?)设计器页面不反映名称空间的更改。2010年还没见过这种情况。

Another issue is when it all works in VS or on your local PC but not when you deploy. This could be because the deployment environment isn't structured the same. For example, the error occurs if you place your code in a virtual directory under an application folder, but it doesn't occur if you create a new application folder and place all of your files in there. I don't understand this one, as I've had the new child/virtual folder set with the same permissions (or so I think) and (I believe) the application pool should work the same for everything in a given application folder.

在我的例子中,我也有一个bin文件夹,其中包含从IIS服务器上的其他程序集更新的程序集。同样,确保这些文件在单独的应用程序文件夹中运行才会成功。

HTH

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

我正在使用Azure移动应用程序,当我添加MVC控制器时,出现了这个问题。如果你从团队资源管理器(撤销)中删除所有文件,你需要从解决方案文件夹中删除bin, obj和Global.asax.cs