Код: Выделить всё
static void Main(string[] args)
{
string configPath = args[0];
var config = ConfigReader.Read(File.OpenRead(configPath));
var client = new AmazonS3Client(config.AccessKeyId, config.SecretAccessKey, Amazon.RegionEndpoint.GetBySystemName(config.AwsRegion));
var path = "path/to/json/file/component.json";
GetObjectRequest request = new GetObjectRequest
{
BucketName = config.BucketName,
Key = path
};
for (int attempt = 0; attempt < 1000; attempt++)
{
using (var response = client.GetObject(request))
{
Console.WriteLine(attempt);
}
}
}
Код: Выделить всё
AmazonS3Client 3221|2025-12-17T15:32:24.514Z|ERROR|An exception of type WebException was handled in ErrorHandler. --> System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
at System.Net.Sockets.Socket.EndReceive(IAsyncResult asyncResult)
at System.Net.Sockets.NetworkStream.EndRead(IAsyncResult asyncResult)
Машина, которая, кажется, быстрее выполняет итерацию цикла for, чаще выходит из строя на 100-й итерации. Я также заметил, что вызовы GetObject выполняются «медленнее» с каждым сотым вызовом, даже если они успешны.
Есть ли у вас идеи, что может быть причиной этого? Я попробовал использовать TransferUtility, но возникла та же проблема.
Подробнее здесь: https://stackoverflow.com/questions/798 ... connection
Мобильная версия