根据这个
https://msdn.microsoft.com/en-us/library/system.net.http.httpclient.baseaddress(v=vs.118).aspx
它包含基地址。好吧,呃......
我不知道微软文档是否应该被理解。到底是什么基地?
是仅包含主机名的网址吗?
赞StackOverflow.com
?
它是整个网址,如stackoverflow.com/question/ask
是包含参数的整个网址,例如stackoverflow.com/hello/world?dfdsdf=34fgdsg
什么是基地址?
答案 0 :(得分:3)
httpclient.baseaddress
用作发送http请求的起点。
示例
如果您必须发送许多以相同地址开头的请求
https://stackoverflow.com/hello/moreinfo1/1
https://stackoverflow.com/hello/moreinfo2/2
所以你必须设置
clt.baseaddress = New URI("https://stackoverflow.com/hello/")
Dim response1 As HttpResponseMessage = Await clt.GetAsync("moreinfo1/1")
Dim response2 As HttpResponseMessage = Await clt.GetAsync("moreinfo2/2")
Else (如果没有设置baseaddress属性)每次发送请求时都必须编写完整的URI
Dim response1 As HttpResponseMessage = Await clt.GetAsync("https://stackoverflow.com/hello/moreinfo1/1")
Dim response2 As HttpResponseMessage = Await clt.GetAsync("https://stackoverflow.com/hello/moreinfo2/2")
有用的链接