从vs 2015开始,可以使用文件系统作为发布方法在iis7上发布Web应用程序mvc 4(模板4.5.2)吗?

时间:2016-04-03 02:12:51

标签: asp.net-mvc asp.net-mvc-4 iis-7 visual-studio-2015

本地环境中的应用程序运行良好,但何时发布 在实时Web服务器上显示

The resource cannot be found. 
 Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly. 

1 个答案:

答案 0 :(得分:0)

我解决了这个问题。对的,这是可能的。

但是,web.config中未定义默认页面。它必须在App_Start目录中的RouteConfig.cs中指定。像这样:

routes.MapRoute(
            name: "Default",
            url: "{controller}/{action}/{id}",
            defaults: new { controller = "Account", action = "Login", id  =   UrlParameter.Optional }
        );

正如您所看到的,绝对路径没有cshtml扩展名,因此可以在url浏览器中输入:

http://server:prort/Account/Login