【发布时间】:2018-06-19 19:29:33
【问题描述】:
我收到这个错误
System.ArgumentException:参数无效。 在 System.Drawing.Bitmap..ctor(字符串文件名) 在 PressRoom.ImageHandler.getResizedImage(String path, Int32 width, Int32 height)
在线
byte[] getResizedImage(String path, int width, int height)
{
if (path!=null)
{
Bitmap imgIn = new Bitmap(path); // exception is thrown
double y = imgIn.Height;
double x = imgIn.Width;
}
我该如何处理这个异常?
【问题讨论】:
-
if (File.Exists(path))
-
它没有帮助。还是一样的错误。
-
我认为您的文件不是有效图片。
-
我有有效的图像文件。当我调试路径显示为“\\Images\\Releases\\Penguins.jpg”
-
@Hima,你在 you_exe_dir\Images\Releases\Penguins.jpg 中有图片吗?
标签: c# asp.net-mvc exception-handling