【问题标题】:Is possible to publish web application mvc 4 (template 4.5.2) on iis7 using file system as publishing method since vs 2015?自 vs 2015 以来,是否可以使用文件系统作为发布方法在 iis7 上发布 Web 应用程序 mvc 4(模板 4.5.2)?
【发布时间】:2016-04-03 02:12:51
【问题描述】:

本地环境中的应用程序运行良好,但是当它发布时 在实时网络服务器上显示

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. 

【问题讨论】:

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


    【解决方案1】:

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

    但是默认页面没有在 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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-10-30
      • 1970-01-01
      • 2013-04-05
      • 2021-05-31
      • 1970-01-01
      • 2021-10-19
      • 1970-01-01
      相关资源
      最近更新 更多