繁体   English   中英

使用 (Bitmap image = new Bitmap(path)) 错误.. 参数无效?

[英]Using (Bitmap image = new Bitmap(path)) Error.. Parameter not valid?

我正在尝试获取图像,但使用以下代码出现错误参数无效。

 if (File.Exists(MapPath(tempFolderPathAlt + "ExtractedFiles\\" + boxPath + "\\" + ArrayNode[i].TagValue)))
    {
      using (Bitmap image = new Bitmap(MapPath(tempFolderPathAlt + "ExtractedFiles\\" + boxPath + "\\" + ArrayNode[i].TagValue)))
        {
          //other code
        }
    }

内部异常为空。

在此处输入图片说明

映射后的路径为:

\\C:\\Users\\Shaun\\Documents\\FormValue\\ExtractedFiles\\Box1e84b34a-522b-492e-919f-1334ee5845ff\\ca4ac72a-9ca2-4a28-b4a4-a6031b734567.png

获取新Bitmap(String)的无效参数异常,其中文件存在通常意味着文件内容无效并且无法被任何图像类型处理程序解析。

最常见的原因之一是基础文件的大小为0

文件太大时我得到了这个异常。

要解决它,请在注册表编辑器中更改“ FileSizeLimitInBytes

  1. 单击“开始”,在“开始搜索”框中键入 regedit,然后按 Enter。
  2. 找到 HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\WebClient\\Parameters
  3. 选择 FileSizeLimitInBytes 并将值更改为更大(超过 50000000)
  4. 重启你的电脑

如果仍然没有帮助,您也可以更改“FsCtlRequestTimeoutInSec”:

  1. HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Services\\MRxDAV\\Parameters
  2. 找到 FsCtlRequestTimeoutInSec 并将值更改为更大(超过 1800 )

不要忘记重新启动 Windows 计算机

有关更多详细信息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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM