gpt4 book ai didi

c# - 将字节数组转换为 Stream 时 ReadTimeout 抛出异常

转载 作者:行者123 更新时间:2023-11-30 18:01:59 30 4
gpt4 key购买 nike

我遇到了这个错误

ReadTimeout = '((System.IO.Stream)(ms)).ReadTimeout' threw an exception of type 'System.InvalidOperationException'.

我的代码是。

byte[] imageBytes = Convert.FromBase64String(img);
MemoryStream ms = new MemoryStream(imageBytes, 0, imageBytes.Length); //Problem generates here//

谢谢..

最佳答案

您可以使用 ReadTimeout/WriteTimeout属性仅当流支持超时。您可以通过 CanTimeout 查看属性(property)。如果 CanTimeout 属性返回 false,对这些属性的所有访问应该引发 InvalidOperationException。

关于c# - 将字节数组转换为 Stream 时 ReadTimeout 抛出异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8487860/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com