雖然我試圖下載大文件從Windows(大小> 170 MB)的移動應用程序我得到這個例外OutOfMemoryException異常,而在下載文件WP8
類型「System.OutOfMemoryException的」未處理的異常發生在System.Windows.ni.dll
附加信息:內存不足以繼續執行程序。
奇怪的是我收到只有少數文件的例外。這是我用來下載文件的代碼
hpubDownloader = new WebClient();
hpubDownloader.OpenReadCompleted += (s, e) =>
{
//process response
};
hpubDownloader.DownloadProgressChanged += (s, e) =>
{
int value = e.ProgressPercentage;
//show progress percentage , and it shows till 98 % after that it goes to exception App_Unhandled exception
};
hpubDownloader.OpenReadAsync(url);
這可能是什麼原因?我沒有得到關於異常的任何其他細節,甚至我試圖把try-catch塊放在webclient下載代碼中,但那也沒有觸發。可能的原因是什麼?
有特定應用中的一些內存限制,如果你的文件是> 170MB意味着你的應用程序使用的所有分配的內存並沒有更多的空間保存我們的剩餘文件。 –
關注下面發表文章 –
將這些大文件下載到內存的目的是什麼?它真的需要嗎?這是一個電話應用程序。 – Romasz