移除Asmx文件 改为Controller API
This commit is contained in:
1 parent
e48ee01201
commit
72f16034ac
27 files changed
+4270
-326
No files matched your search
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Http;
|
||||
using System.Web.Http.Controllers;
|
||||
|
||||
namespace KJD_Web
|
||||
{
|
||||
@@ -10,18 +11,21 @@ namespace KJD_Web
|
||||
{
|
||||
public static void Register(HttpConfiguration config)
|
||||
{
|
||||
// 让 AsmxApiController 的所有 Action 同时支持 GET 和 POST
|
||||
config.Services.Replace(typeof(IHttpActionSelector), new GetPostActionSelector());
|
||||
|
||||
// 特性路由:你 ImageCacheController 上的 [Route] 依赖这个
|
||||
config.MapHttpAttributeRoutes();
|
||||
|
||||
// 默认路由
|
||||
//config.Routes.MapHttpRoute(
|
||||
// name: "DefaultApi",
|
||||
// routeTemplate: "{controller}/{action}/{id}",
|
||||
// defaults: new { id = RouteParameter.Optional }
|
||||
//);
|
||||
//config.Formatters.Remove(config.Formatters.XmlFormatter);
|
||||
//config.Filters.Add(new NotFoundMessageFilter());
|
||||
//config.MessageHandlers.Add(new NotFoundMessageHandler());
|
||||
config.Routes.MapHttpRoute(
|
||||
name: "DefaultApi",
|
||||
routeTemplate: "{controller}/{action}/{id}",
|
||||
defaults: new { id = RouteParameter.Optional }
|
||||
);
|
||||
config.Formatters.Remove(config.Formatters.XmlFormatter);
|
||||
config.Filters.Add(new NotFoundMessageFilter());
|
||||
config.MessageHandlers.Add(new NotFoundMessageHandler());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user