English 中文(简体)
简化多卷文件,作为气流,载于AWS EBS和Load Balancer。
原标题:Streaming Multiple files as zip stream on .net6.0 api fails on AWS EBS with Load Balancer

制作了一个蚊帐(6.0)复印件,读出亚马孙S3 Bucket和Zp文档中的文档,然后通过ZipStream下载。

We have made use of the following method to zip files on fly. Reference : Blog

[HttpGet]
        public async Task ZipAFileS3()
        {
            var s3Keys = this.ListFiles();
            var bucketname = "myBucket";

            Response.ContentType = "application/octet-stream";
            Response.Headers.Add("Content-Disposition", "attachment; filename="files.zip"");

            using (var s3 = CreateS3Client())
            {
                using (var archive = new ZipArchive(Response.BodyWriter.AsStream(), ZipArchiveMode.Create))
                {
                    foreach (var s3Key in s3Keys)
                    {
                        var entry = archive.CreateEntry(Path.GetFileName(s3Key), CompressionLevel.NoCompression);
                        using (var entryStream = entry.Open())
                        {
                            var request = new GetObjectRequest { BucketName = bucketname, Key = s3Key };
                            using (var getObjectResponse = await s3.GetObjectAsync(request))
                            {
                                await getObjectResponse.ResponseStream.CopyToAsync(entryStream);
                            }
                        }
                    }
                }
            }
        }


    public static AmazonS3Client CreateS3Client()
        {
                var AWSAccessKeyId = "";
                var AWSSecretAccessKey = "";
                var Token = "";
                var awsCredentials = new SessionAWSCredentials(AWSAccessKeyId, AWSSecretAccessKey, Token);
                return new AmazonS3Client(awsCredentials, RegionEndpoint.EUWest1);
        }

该台在测试时,高效地在IIS和Nginx服务器上运行。 当地和爱心的Beanstalk, 单一症状

a在<> 甲壳体与Load Balancer相配。 流落在Failed——网络错误的后面,同时正转交齐p文档。

我还检查了云层监测的标志,以核实这一错误是否来自申请方。 我看到,即使在与客户的联系关闭之后,档案传送也在进行。

不能肯定的是,造成这一问题的原因是什么。

“entergraph

“Elgal>

Proxy Server : Nginx

下面是Nginx配置,在出现新情况时加以修改。

user                    nginx;
error_log               /var/log/nginx/error.log warn;
pid                     /var/run/nginx.pid;
worker_processes        auto;
worker_rlimit_nofile    32368;

events {
    worker_connections  1024;
}

http {
    server_tokens off;

    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main   $remote_addr - $remote_user [$time_local] "$request"  
                       $status $body_bytes_sent "$http_referer"  
                       "$http_user_agent" "$http_x_forwarded_for" ;

    include       conf.d/*.conf;

    map $http_upgrade $connection_upgrade {
        default     "upgrade";
    }

    server {
        listen        80 default_server;
        access_log    /var/log/nginx/access.log main;

        client_header_timeout 864000;
        client_body_timeout   864000;
        keepalive_timeout     864000;
        gzip                  on;
        gzip_comp_level       4;
        gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;

        add_header Connection "keep-alive";
        add_header Accept-Encoding gzip;
        add_header Accept-Ranges "bytes";
        add_header Cache-Control "private, no-transform, no-store";
        add_header Content-Transfer-Encoding "binary";
        
        

        # Include the Elastic Beanstalk generated locations
        include conf.d/elasticbeanstalk/*.conf;
    }
}
问题回答

暂无回答




相关问题
Mount windows shared drive to MWAA in bootscript

In MWAA startup script sudo yum install samba-client cifs-utils -y sudo mount.cifs //dev/test/drop /mnt/dev/test-o username=testuser,password= pwd ,domain=XX Executing above commonds giving error - ...

How to get Amazon Seller Central orders programmatically?

We have been manually been keying Amazon orders into our system and would like to automate it. However, I can t seem to figure out how to go about it. Their documentation is barely there. There is: ...

Using a CDN like Amazon S3 to control access to media

I want to use Amazon S3/CloudFront to store flash files. These files must be private as they will be accessed by members. This will be done by storing each file with a link to Amazon using a mysql ...

unable to connect to database on AWS

actually I have my website build with Joomla hosted on hostmonster but all Joomla website need a database support to run this database is on AWS configuration files need to be updated for that I ...

Using EC2 Load Balancing with Existing Wordpress Blog

I currently have a virtual dedicated server through Media Temple that I use to run several high traffic Wordpress blogs. Both tend to receive sudden StumbleUpon traffic surges that (I m assuming) ...

SSL slowness in EC2

We ve deployed our rails app to EC2. In our setup, we have two proxies on small instances behind round-robin DNS. These run nginx load balancers for a dynamically growing and shrinking farm of web ...

热门标签