httpclient下载远程文件,代替过时的webClient

  • binGe博客
  • 开发笔记
  • 2024/1/25 17:17:16
  • 人已阅读
简介
httpclient下载远程文件,代替过时的webClient
    using (var web = new HttpClient())
            {
                //WebClient过期用法:await web.DownloadFileTaskAsync(FileUrl, fileDesPath);                
                using (Stream output = SystemIO.File.OpenWrite(AppDomain.CurrentDomain.BaseDirectory + fileServerPath))
                using (Stream input = await web.GetStreamAsync(Input.Url))
                {
                    input.CopyTo(output);
                }
            }

上一篇:net6.0解析实体字典

下一篇:JNTemplate

文章评论

评论
  • 消灭零回复
Top