1 /// <summary> 2 /// Values控制器 3 /// </summary> 4 public class ValuesController : ApiController 5 { 6 /// <summary> 7 /// Get請求 8 /// </summary> 9 /// <returns></returns> 10 public IEnumerable<string> Get() 11 { 12 return new string[] { "value1", "value2" }; 13 } 14 }
helpageweb
Help/Api/GET-api-Valuesapi
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); }
WebApplication/Areas/HelpPage/App_Start/HelpPageConfig.cs 目錄下,找到下面代碼,並取消註釋(App_Data 改成 bin):app
public static void Register(HttpConfiguration config) { //// Uncomment the following to use the documentation from XML documentation file. config.SetDocumentationProvider(new XmlDocumentationProvider(HttpContext.Current.Server.MapPath("~/bin/XmlDocument.xml"))); }
/// <summary> /// Values控制器 /// </summary> public class ValuesController : ApiController { ........ /// <summary> /// POST 操做 /// </summary> /// <param name="value">value值</param> public void Post([FromBody]string value) { } }