3
從asp.net應用程序讀取/存儲Amazon S3對象時偶爾會出現異常。與亞馬遜的WSACancelBlockingCall異常
例外說: 無法從傳輸連接讀取數據:阻塞操作被調用WSACancelBlockingCall中斷。一個阻塞操作是通過調用中斷WSACancelBlockingCall
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)
我如何能找到什麼是這個錯誤的原因,任何想法?
這裏是我讀功能:
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;
}
s3Client被初始化在這個類的構造函數:
s3Client = AWSClientFactory.CreateAmazonS3Client(AWSAccessKey, AWSSecretKey);