根据这个
https://msdn.microsoft.com/en-us/library/system.net.http.httpclient.baseaddress(v=vs.118).aspx
它包含基址。嗯,呃..。
我不知道微软文档是否意味着要被理解。基本地址到底是什么?
是只有主机名的URL吗?
就像StackOverflow.com
是不是整个网址都像stackoverflow.com/question/ask
是否包含参数(如stackoverflow.com/hello/world?dfdsdf=34fgdsg )的整个URL
基本地址是什么?
发布于 2017-03-20 22:21:11
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")否则(如果不设置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")有用链接
https://stackoverflow.com/questions/42914791
复制相似问题