C# 无法保存文件,因为无法读取源文件。请稍后再试,或与服务器管理员联系
我的库中有下面的代码,并使用WCF服务访问该方法以导出保存的位图图像,并使用“HttpContext.Current.Server.MapPath”将其存储在项目位置。图像已成功保存在该位置,但我无法使用HttpResponse打开同一文件?我得到了以下例外 注意:HttpResponse正在从WCF发送到库方法 无法保存C:\Users\Username~1.SYN\AppData\Local\Temp\32quwNBj.bmp.part,因为无法读取源文件。请稍后再试,或与服务器管理员联系C# 无法保存文件,因为无法读取源文件。请稍后再试,或与服务器管理员联系,c#,asp.net,wcf,visual-studio-2012,httpresponse,C#,Asp.net,Wcf,Visual Studio 2012,Httpresponse,我的库中有下面的代码,并使用WCF服务访问该方法以导出保存的位图图像,并使用“HttpContext.Current.Server.MapPath”将其存储在项目位置。图像已成功保存在该位置,但我无法使用HttpResponse打开同一文件?我得到了以下例外 注意:HttpResponse正在从WCF发送到库方法 无法保存C:\Users\Username~1.SYN\AppData\Local\Temp\32quwNBj.bmp.part,因为无法读取源文件。请稍后再试,或与服务器管理员联系
这似乎是firefox的问题,在chrome或IE中尝试过?在这两种浏览器中都没有相同的问题。安装Firefox38将解决这个问题。所以你可以结束这个问题。!
System.Web.HttpResponse response = HttpContext.Current.Response;
Bitmap Bitmap = this.GetBitMapImage("Bitmap+path");
fileName += ".png";
filePath = HttpContext.Current.Server.MapPath("~/App_Data");
if (!System.IO.Directory.Exists(filePath))
System.IO.Directory.CreateDirectory(filePath);
bitmap.Save(filePath + "\\" + fileName);
response.Clear();
response.ClearContent();
response.ClearHeaders();
response.ContentType = "image/" + exportMode;
response.AppendHeader("Content-Disposition", "attachment; filename=" + fileName);
response.TransmitFile(System.IO.Path.Combine(filePath, fileName));
//response.WriteFile(filePath + "\\" + fileName);
reso
response.Flush();
response.Close();