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
{
}
}
}