public static void RegisterRoutes(RouteCollection routes)
{
routes.RouteExistingFiles = true;
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Index", action = "Index", id = UrlParameter.Optional }, namespaces: new[] { "Web.Controllers" }
);
}
組態檔設定如下
<modules runAllManagedModulesForAllRequests="true">
</modules>
IIS Express 配置如下:
<add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition="" />
<!--<add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition="managedHandler,runtimeVersionv4.0" />-->
經過以下配置,開發環境下,只要檔案存在的,還是能回傳。但是發布到IIS是好的,請問什么原因
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/48140.html
