日期:2014-05-17  浏览次数:21025 次

远程服务器返回错误: (404) 未找到。 求解:
错误如题:

出现错误原因:
      上传 很多文件 后缀名是不一致的 但是 在下载的时候 后缀名为 .config .log .bat .ini 就会出现错误,所报的错误就是 远程服务器返回错误: (404) 未找到。

代码如下:
        /// <summary>
       /// 异步升级
        /// </summary>
        private void DownloadAllFiles()
        {
            try
            {
                //判断是否能连接服务器
                ulc.GET_CONN();
                string filename = dt.Rows[downfilenum]["文件"].ToString();
                string filepath = dt.Rows[downfilenum]["客户端路径"].ToString();
                string serverpath = "http://" + ConfigHelper.GetConfigString("ServerIP") + "/upgrade/";
                serverpath = serverpath + filename;
                string localFilePath = Path.Combine(this.UpdateFolderPath, filename);

                webClient.DownloadFileAsync(new Uri(serverpath), localFilePath);
                gridView1.SetRowCellValue(downfilenum, "下载状态", "正在下载...");
            }
            catch (Exception ex)
            {
                Directory.Delete(Application.StartupPath + @"\update", true);
                Directory.CreateDirectory(Application.StartupPath + @"\update");
                MessageHelper.Show("连接不上服务器!", MessageType.Information);