问题:服务器跟换了一个exe文件,部分客户端下载的还是之前的exe(大部分客户端正常)
同样路径方法下 下载非exe 文件正常!!!!!!是客户端问题还是服务端问题?
是代码问题还是客户端电脑问题?
string UpdateFile = lvUpdateList.Items[i].Text.Trim();
string updateFileUrl = updateUrl + lvUpdateList.Items[i].Text.Trim();
long fileLength = 0; WebRequest webReq = WebRequest.Create(updateFileUrl);
WebResponse webRes = webReq.GetResponse();
fileLength = webRes.ContentLength; lbState.Text = "正在下载更新文件,请稍后...";
pbDownFile.Value = 0;
pbDownFile.Maximum = (int)fileLength; Stream srm = webRes.GetResponseStream();
StreamReader srmReader = new StreamReader(srm);
byte[] bufferbyte = new byte[fileLength];
int allByte = (int)bufferbyte.Length;
int startByte = 0;
while (fileLength > 0)
{
Application.DoEvents();
int downByte = srm.Read(bufferbyte, startByte, allByte);
if (downByte == 0) { break; };
startByte += downByte;
allByte -= downByte;
pbDownFile.Value += downByte; float part = (float)startByte / 1024;
float total = (float)bufferbyte.Length / 1024;
int percent = Convert.ToInt32((part / total) * 100); this.lvUpdateList.Items[i].SubItems[2].Text = percent.ToString() + "%"; } string tempPath = tempUpdatePath + UpdateFile;
CreateDirtory(tempPath);
FileStream fs = new FileStream(tempPath, FileMode.OpenOrCreate, FileAccess.Write);
fs.Write(bufferbyte, 0, bufferbyte.Length);
srm.Close();
srmReader.Close();
fs.Close();
解决方案 »
- 求各位大神帮我把这段关于CRC16校验的C代码转换成为C#代码,高分送上!
- string 转化成id?
- c#combombox中显示时间的格式问题
- ------------------------------求IIS几个属性------------------
- 请问如何实现类似MYSPACE的邮件邀请?高分求教!
- 如何实现设计时控件属性联动,高手请进
- treeview有两层节点,怎样实现所有父节点无checkbox而所有子节点有checkBox
- 各位大哥大姐帮帮我,我都快不行了。
- 如何才能序列化一个继承类?????(很痛苦啊)
- 那里有有关分布式计算和多层应用的C#的资料?
- 求助,关于反射机制实例化非静态函数
- c#中出现:对象引用对于非静态的字段、方法和属性“”是必需的,这一错误如何解决
还有招吗?