WebApiConfig
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;
namespace SAP.Application.WebService
{
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
config.MapHttpAttributeRoutes();
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
}
}
}
Global
protected void Application_Start(object sender, EventArgs e)
{
GlobalConfiguration.Configure(WebApiConfig.Register);
}
ApiController
public class CP10Controller : ApiController
{
private LogHelper logger = new LogHelper(typeof(ApiController));
[HttpPost]
public IHttpActionResult CallBack(CP10CallbackData callbackData)
{
return Json(CP10AccessResult.SuccessMessage("回调成功"));
}
}