好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

C# 调用WebApi

1.WebRequest方式

Get:

using (WebClient client = new WebClient())

{

     client.Headers["Type"] = "GET";

     client.Headers["Accept"] = "application/json";

     client.Encoding = Encoding.UTF8;

     client.DownloadStringCompleted += (senderobj, es) =>

     {

         var obj = es.Result;

     };

     client.DownloadStringAsync("http://localhost:41558/api/Demo");

}



查看更多关于C# 调用WebApi的详细内容...

  阅读:14142次