1

我正在尝试更改我的 web api 的根 url 来运行一个操作,但是当使用尝试映射时,我在运行时收到一个错误,说我不能使用/~作为我的路由。

config.Routes.MapHttpRoute("RootInformation", "/", new {controller = "Core", action = "GetInformation"});

如何添加此根 URL 路由

4

1 回答 1

4

尝试这个:

config.Routes.MapHttpRoute(
        name: "RootInformation", 
        routeTemplate: "", 
        defaults: new 
        {
             Controller = "Core", 
             Action = "GetInformation"
        }
 );
于 2013-10-21T09:01:27.727 回答