0
votes

I have an web application that works fine when uploading pictures but when uploading larger videos to picasa, I sometimes get an error message. Is there a way I can know that the steam is not needed anymore so I can close it (using the keyword "using" or something) thanks for any advice. Error

System.Net.WebException: The request was aborted: The request was canceled. ---> System.IO.IOException: Cannot close stream until all bytes are written.

 PicasaEntry entry = service.Insert(postUri, videoEntry);//This is the line that does the call
                PhotoAccessor googlePhoto = new PhotoAccessor(entry);
                stream.Close();//Fails here
1
Need a couple more lines of code; can you show where you initialize the stream and how you use the stream please? If I remember correctly, one of the overloads for service.Insert takes a stream object... - dash

1 Answers

2
votes

I'm not sure exactly what type your stream object is, but the base Stream class has a Flush method you can call to force everything in the stream to be written.

stream.Flush();
stream.Close();

MSDN Documentation