目前我正在尝试从WCF下载音轨,我需要一些帮助写入硬盘,如何配置流水或其他在webApp中执行此操作?
// Use Service to download stream (returns System.IO.Stream) Stream stream = MyService.Download(("1231")); // ReadStream StreamReader reader = new StreamReader(stream); reader.ReadToEnd(); // Write this stream to a file/Hard disk ???
解决方法
Stream stream = MyService.Download(("1231")); using (Stream s = File.Create(path)) { stream.CopyTo(s); }