I am trying to upload Videos to YouTube API... It's working fine if my video file is < 4 MB..
Below is my code.. i think the issue is related to Request Length?!
Update: the error i am getting is "Cannot close stream until all bytes are written."
Upload Code
YouTubeRequestSettings settings = new YouTubeRequestSettings("App NAME", "DeveloperKEY", "UserName", "Password");
YouTubeRequest request = new YouTubeRequest(settings);
request.Settings.Timeout = 9999999;
Video newVideo = new Video();
newVideo.Title = "Movie size 3 MB";
newVideo.Tags.Add(new MediaCategory("Autos", YouTubeNameTable.CategorySchema));
newVideo.Keywords = "cars, funny";
newVideo.Description = "My description";
newVideo.YouTubeEntry.Private = false;
newVideo.Tags.Add(new MediaCategory("mydevtag, anotherdevtag", YouTubeNameTable.DeveloperTagSchema));
string videoPath = "c:\\1.flv";
newVideo.YouTubeEntry.MediaSource = new MediaFileSource(videoPath, GetContentType(videoPath));
Video createdVideo = request.Upload(newVideo);
litMessage.Text = "Video " + newVideo.Title + " uploaded.";
Web.config
<httpRuntime
executionTimeout="240"
maxRequestLength="40960"
requestLengthDiskThreshold="80"
useFullyQualifiedRedirectUrl="false"
minFreeThreads="8"
minLocalRequestFreeThreads="4"
appRequestQueueLimit="5000"
enableKernelOutputCache="true"
enableVersionHeader="true"
requireRootedSaveAsPath="true"
enable="true"
shutdownTimeout="90"
delayNotificationTimeout="5"
waitChangeNotification="0"
maxWaitChangeNotification="0"
enableHeaderChecking="true"
sendCacheControlHeader="true"
apartmentThreading="false" />
I don't think it's the request length. AFAIK you use that when you are receiving an uploaded file. Seems to me that there's a timeout somewhere. Raise the timeout value in both your code and the HTTPRuntime portion of the Web.Config and see if that works.