System.Runtime.InteropServices.ExternalException: GDI+ 中发生一般性错误。

sy_flydream 2012-11-13 10:40:25
net端接收flash上传的图像的二进制流,然后保存图片到服务器路径。现在纳闷死了老是报GDI+错误,关键是偶尔会报错,网上 也没查到合适的原因,麻烦擅长GDI这块的大侠帮忙看下是怎么回事。

Stream _stream = Request.InputStream;
string path = HttpContext.Current.Request.MapPath("upload/");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
try
{
using (Bitmap bitMap = new Bitmap(_stream))
{
string imgName = path + DateTime.Now.Ticks.ToString() + ".png";
bitMap.Save(imgName, ImageFormat.Png);
}
}
catch (Exception ex)
{
System.Web.HttpContext.Current.Response.Write(ex.Message);
}
...全文
792 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
猫熊 2013-02-17
  • 打赏
  • 举报
回复
偶尔报错....... catch捕获到的信息贴一下 啊;

110,499

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧