我得到了错误
无法加载类型mvcapapplication
当我试图运行我的网站时。
如何纠正?
我得到了错误
无法加载类型mvcapapplication
当我试图运行我的网站时。
如何纠正?
当前回答
我的问题是我有两个项目在同一个端口上运行。解决方案是更改端口并为新项目重新创建一个新的虚拟目录
其他回答
我已经有bin/在我的构建标签。我是全球化的。Asax从另一个项目的副本,但没有工作。
最终对我有效的解决方案是删除bin/文件夹,并创建一个具有相同名称的新空文件夹。
如果您更改了名称空间,请确保右键单击并重构。
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项目的程序集不可用,你会得到这个错误。但这可能是一个常见的场景,特别是因为您实际上编译了您的解决方案——项目只是没有得到构建。
在过去的十年里,我已经见过很多次了,现在又一次。有许多问题都会导致同样的错误。
一个原因是文件的重命名。如果您使用的是.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
这些东西我都测试过了,没有一个管用。然后我想起来我是通过IIS的本地实例运行站点的,并且已经移动了编译代码的目录。换句话说,我的IIS站点设置为查看有问题的旧目录。进入IIS并将站点的根目录更改为我的新目录显然解决了这个问题。