我得到了错误
无法加载类型mvcapapplication
当我试图运行我的网站时。
如何纠正?
我得到了错误
无法加载类型mvcapapplication
当我试图运行我的网站时。
如何纠正?
当前回答
这些东西我都测试过了,没有一个管用。然后我想起来我是通过IIS的本地实例运行站点的,并且已经移动了编译代码的目录。换句话说,我的IIS站点设置为查看有问题的旧目录。进入IIS并将站点的根目录更改为我的新目录显然解决了这个问题。
其他回答
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项目的程序集不可用,你会得到这个错误。但这可能是一个常见的场景,特别是因为您实际上编译了您的解决方案——项目只是没有得到构建。
我尝试了很多建议,但对我有效的是使用Visual studio的“发布”功能(在Build选项卡中)。我只是使用FTP部署选项将比特与我的FTP信用一起发送到我的服务器。然后我将IIS指向该目录。当然,要检查应用程序池中是否有正确的框架。
检查global.asax中提供的信息背后的代码。它们应该正确地指向后面代码中的类。
示例global.asax:
<%@ Application Codebehind="Global.asax.cs" Inherits="MyApplicationNamespace.MyMvcApplication" Language="C#" %>
背后的示例代码:
namespace MyApplicationNamespace
{
public class MyMvcApplication : System.Web.HttpApplication
{
protected void Application_Start( )
{
AreaRegistration.RegisterAllAreas( );
FilterConfig.RegisterGlobalFilters( GlobalFilters.Filters );
RouteConfig.RegisterRoutes( RouteTable.Routes );
BundleConfig.RegisterBundles( BundleTable.Bundles );
}
}
}
我得到这个错误,因为我的版本控制已经设置为忽略我的bin文件夹。非常愚蠢,但也许其他人会从中受益。
确保你不应该打开MVC项目像File->打开网站使用File->打开项目。