Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sockets/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 上载到S3-无法在套接字上执行操作,因为系统缺少足够的缓冲区空间_C#_Sockets_Asp.net Mvc 4_Amazon Web Services_Amazon S3 - Fatal编程技术网

C# 上载到S3-无法在套接字上执行操作,因为系统缺少足够的缓冲区空间

C# 上载到S3-无法在套接字上执行操作,因为系统缺少足够的缓冲区空间,c#,sockets,asp.net-mvc-4,amazon-web-services,amazon-s3,C#,Sockets,Asp.net Mvc 4,Amazon Web Services,Amazon S3,我有一个用C#和MVC4构建的网站,用户可以上传大文件,然后将这些文件发送到AmazonS3 它是间歇性的,但我不断得到以下错误: “无法对套接字执行操作,因为系统缺少足够的缓冲区空间或队列已满54.231.236.12:443” 我目前正在使用InputStream作为S3的PutObject。对于PutObject为什么会在这些较大的文件上出现故障,有人有什么建议吗 下面是我用来将HttpPostedFileBase发送到Amazon的代码: HttpPostedFileBase hpf

我有一个用C#和MVC4构建的网站,用户可以上传大文件,然后将这些文件发送到AmazonS3

它是间歇性的,但我不断得到以下错误:

“无法对套接字执行操作,因为系统缺少足够的缓冲区空间或队列已满54.231.236.12:443”

我目前正在使用InputStream作为S3的PutObject。对于PutObject为什么会在这些较大的文件上出现故障,有人有什么建议吗

下面是我用来将HttpPostedFileBase发送到Amazon的代码:

 HttpPostedFileBase hpf = Request.Files[0] as HttpPostedFileBase;

            if (hpf.ContentLength > 0)
            {
                string accessKey = ConfigurationManager.AppSettings["Amazon_Access_Key"];
                string secretKey = ConfigurationManager.AppSettings["Amazon_Secret_Key"];


                AmazonS3Client client;

                var filePath = UserID + "/" + hpf.FileName;

                client = new AmazonS3Client(accessKey, secretKey, RegionEndpoint.USWest1);

                PutObjectRequest request = new PutObjectRequest();

                request.BucketName = "MyBucket";
                request.CannedACL = S3CannedACL.PublicRead;
                request.Key = filePath;
                request.InputStream = hpf.InputStream;
                client.PutObject(request);
            }
                return Json(new {message = "chunk uploaded", name = name});

我不确定将大文件上传到S3时的问题是什么意思,但从您发布的错误消息来看,似乎您试图一次性上传一个大文件。我建议你把你的大文件上传成块。我找到了一些可以帮助实现它的链接

希望这个链接可以帮助你