I am going to upload an RAR file on Amazon Server. the folder is around 30MB.
I have tried to to upload this rar file using BackGroudWorker and Thread but not getting the solution. If i remove thread and backgroudworker than also getting the following error.
"The CLR has been unable to transition from COM context
0x2183e0 to COM context 0x218550 for 60 seconds.
The thread that owns the destination context/apartment
is most likely either doing a non pumping wait or processing
a very long running operation without pumping Windows messages.
This situation generally has a negative performance impact
and may even lead to the application becoming non responsive
or memory usage accumulating continually over time. To avoid
this problem, all single threaded apartment (STA) threads
should use pumping wait primitives (such as
CoWaitForMultipleHandles) and routinely pump messages
during long running operations."
My application is in VB.NET windows based. I have two Function.. AmazonS3 Client, Filename , Path, and Str3_Key for amazon
here is the code:
Public Sub CreateNewFile(client As AmazonS3, filename As String, filepath As String, strs3_key As String)
Try
Cursor.Current = Cursors.WaitCursor
Dim S3_KEY As [String] = strs3_key
Dim request As New PutObjectRequest()
request.WithBucketName(amazon_bucket_name)
request.WithKey(S3_KEY)
request.WithContentBody("")
client.PutObject(request)
UploadFile(client, S3_KEY, filepath)
Cursor.Current = Cursors.Default
Catch ex As Exception
Cursor.Current = Cursors.Default
MessageBox.Show(ReadException(ex))
End Try
End Sub
Public Shared Sub UploadFile(client As AmazonS3, S3_key As String, FilePath As String)
Try
Dim request As New PutObjectRequest()
request.WithBucketName(amazon_bucket_name)
request.WithKey(S3_key)
request.WithFilePath(FilePath)
client.PutObject(request)
Catch ex As Exception
End Try
End Sub