title: The connection with the server was terminated abnormally (AWS S3 file upload)
body: <p>Using the following code to upload a gzip file to S3:</p>
  
  <pre><code>class Program
  {
      public static AWSCredentials credentials;
  
      static Program()
      {
          var chain = new CredentialProfileStoreChain();
          if (!chain.TryGetAWSCredentials("awsConfig", out credentials))
              throw new Exception("AWS Credentials not found!!");
      }
  
      static void Main(string[] args)
      {
          var filePath = $@"C:\temp\test.gz";
          UploadFile("myBucket", filePath, "test");
      }
  
      private static void UploadFile(string bucketName, string filePath, string prefixKey)
      {
          TransferUtility fileTransferUtility = new TransferUtility(new AmazonS3Client(credentials, Amazon.RegionEndpoint.USEast1));
  
          TransferUtilityUploadRequest fileTransferUtilityRequest = new TransferUtilityUploadRequest
          {
              BucketName = bucketName,
              FilePath = filePath,
              Key = prefixKey,
          };
  
          fileTransferUtility.Upload(fileTransferUtilityRequest);
          Console.WriteLine("Upload completed");
      }
  }
  </code></pre>
  
  <p>I am getting the error <strong>The write operation failed, see inner exception</strong> where the inner exception is <strong>System.Net.Http.WinHttpException: The connection with the server was terminated abnormally</strong></p>
  
  <p>I thought it could be a network problem so I uploaded the application to an EC2 instance in the same region as the bucket and still getting the same error.</p>
  
  <p>The file test.gz is a file with gzip compression and its size is 274kb.</p>
  
  <p>This problem happens only with some files all compressed the same way.</p>
  
  <p>What could be the reason of this error?</p>
  
  <p>Let me know if you need the file to test.</p>
  
  <p>Here is the complete stack trace: <a href="https://pastebin.com/RJ8QSmSK" rel="nofollow noreferrer">https://pastebin.com/RJ8QSmSK</a></p>