Asp.net MVC 自定义路由

在做公司接口的时候  由于规范API 要用点分割。 如: HealthWay.controller.action

 在MVC 4 下面做了个 路由配置如下:

public override void RegisterArea(AreaRegistrationContext context)
        {

            context.MapRoute(
                "HealthWay_default",
                "HealthWay.{controller}.{action}",
                new { action = "Index" }
            );
        }

部署后一直提示 :

HTTP 错误 404.0 - Not Found

您要找的资源已被删除、已更名或暂时不可用。

原因是 iis 上的集成.net 4.0  不支持这样格式。

在配置文件中加上如下代码,就解决了

  <system.webServer> 
    <modules runAllManagedModulesForAllRequests="true"/> 
  </system.webServer>
原文地址:https://www.cnblogs.com/dragon-L/p/5216921.html