title: WSACancelBlockingCall Exception with Amazon
body: <p>I have occasional exception when reading / storing objects with Amazon S3 from asp.net application.</p>
  
  <p>Exception says: 
  <strong>Unable to read data from the transport connection: A blocking operation was interrupted by a call to WSACancelBlockingCall. A blocking operation was interrupted by a call to WSACancelBlockingCall</strong></p>
  
  <pre><code>at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
  at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
  </code></pre>
  
  <p>Any ideas about how I can locate what is reason  of this error?</p>
  
  <p>here is my read function:</p>
  
  <pre><code>    public Image GetImage(string fullKey, out string errorMessage)
      {
          errorMessage = null;
          try
          {
              GetObjectResponse response = s3Client.GetObject(new GetObjectRequest()
              {
                  BucketName = BucketName,
                  Key = fullKey,
                  Timeout = ImportTimeout
              });
              return Image.FromStream(response.ResponseStream);
          }
          catch (Exception e)
          {
              errorMessage = e.Message;
              Log.Current.WriteError(e);
          }
          return null;
      }
  </code></pre>
  
  <p>s3Client is initialised in constructor of this class:</p>
  
  <pre><code>s3Client = AWSClientFactory.CreateAmazonS3Client(AWSAccessKey, AWSSecretKey);
  </code></pre>