[英]Using (Bitmap image = new Bitmap(path)) Error.. Parameter not valid?
I'm trying to get an image but i get the error Parameter not valid with the following code.我正在尝试获取图像,但使用以下代码出现错误参数无效。
if (File.Exists(MapPath(tempFolderPathAlt + "ExtractedFiles\\" + boxPath + "\\" + ArrayNode[i].TagValue)))
{
using (Bitmap image = new Bitmap(MapPath(tempFolderPathAlt + "ExtractedFiles\\" + boxPath + "\\" + ArrayNode[i].TagValue)))
{
//other code
}
}
The inner exception is null.内部异常为空。
The Path after this is mapped is:映射后的路径为:
\\C:\\Users\\Shaun\\Documents\\FormValue\\ExtractedFiles\\Box1e84b34a-522b-492e-919f-1334ee5845ff\\ca4ac72a-9ca2-4a28-b4a4-a6031b734567.png \\C:\\Users\\Shaun\\Documents\\FormValue\\ExtractedFiles\\Box1e84b34a-522b-492e-919f-1334ee5845ff\\ca4ac72a-9ca2-4a28-b4a4-a6031b734567.png
Getting an Invalid Parameter Exception for a new Bitmap(String)
, where the file exists generally means that the file content is invalid and can't be parsed by any of the image type handlers.获取新Bitmap(String)
的无效参数异常,其中文件存在通常意味着文件内容无效并且无法被任何图像类型处理程序解析。
One of the most common reasons for this is that the underlying file is of 0
size.最常见的原因之一是基础文件的大小为0
。
I got this exception when file was too large .当文件太大时我得到了这个异常。
to solve it, change ' FileSizeLimitInBytes ' in registry editor要解决它,请在注册表编辑器中更改“ FileSizeLimitInBytes ”
If it still doesn't help, you change 'FsCtlRequestTimeoutInSec' too:如果仍然没有帮助,您也可以更改“FsCtlRequestTimeoutInSec”:
don't forget to restart your windows computer不要忘记重新启动 Windows 计算机
for more details https://support.microsoft.com/en-us/help/2668751/you-cannot-download-more-than-50-mb-or-upload-large-files-when-the-upl有关更多详细信息https://support.microsoft.com/en-us/help/2668751/you-cannot-download-more-than-50-mb-or-upload-large-files-when-the-upl
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.