我想映射网址melt(setDT(mydf), measure = patterns("ID", "string"), na.rm=TRUE,
value.name = c("Ids", "string"))[!duplicated(Ids, fromLast=TRUE)
][, variable := NULL][order(Ids)]
-
RouteConfig.cs -
http://localhost:49930/upload
控制器 -
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional },
namespaces: new[] { "BrSupervisorTracker.Controllers" }
);
routes.MapRoute(
name: "ExcelUploader",
url: "upload/{controller}/{action}/{id}",
defaults: new { controller = "FileUpload", action = "Index", id = UrlParameter.Optional },
namespaces: new[] { "BrSupervisorTracker.Controllers" }
);
}
}
但它不起作用。返回HTTP 404.任何帮助?
答案 0 :(得分:1)
路由按顺序进行评估,因此../upload
与您的第一个(Default
)路由匹配,并尝试调用Index()
UploadController
不存在的404
方法,因此{ {1}}回复。
交换路由以使ExcelUploader
路由位于Default
路由之前,并删除不必要的段/参数
routes.MapRoute(
name: "ExcelUploader",
url: "upload",
defaults: new { controller = "FileUpload", action = "Index"},
namespaces: new[] { "BrSupervisorTracker.Controllers" }
);
routes.MapRoute(
name: "Default",
....
};