为什么新的HttpClient实例没有加载网站的更新版本?

时间:2017-10-12 11:39:35

标签: vb.net http uwp

我正在尝试从一个不断更新的网站下载某个数据库中的数据,例如。例如,weather station

我正在使用VB.Net中的UWP-App。 要做到这一点,我在调度员的帮助下每隔60秒调用一个子。 该函数创建Windows.Web.Http.HttpClient和Windows.Web.Http.HttpResponseMessage的新实例,然后使用固定URI下载网站。 然后将HttpResponseMessage的内容转换为字符串,并提取和处理数据。

Async Sub GetDataTest()

        Dim result as String
        Dim myUri As Uri = New Uri("http://weather.namsearch.com/")
        Dim myClient As Windows.Web.Http.HttpClient = New Windows.Web.Http.HttpClient
        Dim myResponse As Windows.Web.Http.HttpResponseMessage = New Windows.Web.Http.HttpResponseMessage
        myResponse = Await myClient.GetAsync(myUri)

        result = myResponse.Content.ToString
End Sub

每次调用Sub时,尽管网站中的数据(例如windspeed)正在发生变化,但响应消息的内容与之前的呼叫相同。这是什么原因,我该如何避免这个问题? 非常感谢

0 个答案:

没有答案
相关问题