我試圖將視頻上傳到YouTube API ...它的正常工作,如果我的視頻文件< 4 MB ..上傳大文件到YouTube API(.NET)
下面是我的代碼..我想該問題與請求長度有關?
更新:我得到的錯誤是「無法關閉流,直到寫入所有字節」。
上傳代碼
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" />
Nope也沒有工作..實際上它被設置爲100 MB,但忘記在問題中提到。 – Taha 2011-02-24 08:54:04