调试WebApi的一些方法
1、Get方法时,直接用浏览器访问
2、Postman
3、用HttpClient调用
privatevoid GetData() { using (HttpClient client = new HttpClient()) { client.BaseAddress = new Uri("ipaddress");
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); try { HttpResponseMessage response = client.GetAsync("testapi/getdata?id=0").Result; } catch { } } }
版权声明:本文为dayang12525原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。