首次连接到网页的速度很慢 [英] First connection to webpage slow

查看:61
本文介绍了首次连接到网页的速度很慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个代码可以连接到php页面以检查版本,但是第一次它总是很慢.
之后,它立即获得内容,有人知道为什么吗?

我使用:

I have a code that connects to a php page to check a version, but its always so slow on the first time.
After that it gets the content instantly, anyone know why?

I use:

try
            {
                WebRequest req = WebRequest.Create(URI);
                WebResponse resp = req.GetResponse();
                StreamReader sr = new StreamReader(resp.GetResponseStream());
                return sr.ReadToEnd().Trim();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return null;
            }

推荐答案

可能是缓存问题.

http://msdn.microsoft.com/en-us/library/system. net.webrequest.cachepolicy.aspx [ ^ ]
Possibly a caching issue.

http://msdn.microsoft.com/en-us/library/system.net.webrequest.cachepolicy.aspx[^]


这篇关于首次连接到网页的速度很慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆