处理完图像后,无法删除c#中的图像

时间:2016-06-14 05:09:26

标签: c# file

string imagePath = HttpContext.Current.Server.MapPath("~/Resources/image.jpeg");
if (File.Exists(imagePath))
{
    File.Delete(imagePath);
    Debug.WriteLine("image path exists");
}

using (var imageStream = new MemoryStream(binData))
{
    Bitmap image = new Bitmap(imageStream);

    image.Save(imagePath, System.Drawing.Imaging.ImageFormat.Jpeg);
    image.Dispose();
}

我收到System.IO.IOException ..无法访问该流程,因为它已在使用中

0 个答案:

没有答案