[Mono-dev] Cannot re-call start of asynchronous method... Error
Robert Jordan
robertj at gmx.net
Tue Sep 23 10:31:35 EDT 2008
acoupe wrote:
> Here's the full error:
>
> System.InvalidOperationException: Cannot re-call start of asynchronous
> method while a previous call is still in progress.
> at System.Net.HttpWebRequest.BeginGetRequestStream (System.AsyncCallback
> callback, System.Object state) [0x00000]
> at System.Net.HttpWebRequest.GetRequestStream () [0x00000]
> at AWSAuthConnection.putStream (System.String bucket, System.String key,
> S3StreamObject obj,
> System.Collections.SortedList headers) [0x00000]
> at Test.Projects.UploadFile (System.String UploadFileName, System.String
> S3Key) [0x00000]
>
Change this
> int bytesRead = 0;
> while ((bytesRead = bufferedInput.Read(buf, 0, 1024)) > 0)
> {
> contentLength += bytesRead;
> request.GetRequestStream().Write( buf, 0, bytesRead );
> }
> request.GetRequestStream().Close();
to:
Stream reqStm = request.GetRequestStream();
int bytesRead = 0;
while ((bytesRead = bufferedInput.Read(buf, 0, 1024)) > 0)
{
contentLength += bytesRead;
reqStm.Write( buf, 0, bytesRead );
}
reqStm.Close();
And please file a bug at http://www.mono-project.com/Bugs
Robert
More information about the Mono-devel-list
mailing list