我在Windows Azure中遇到問題。我將臨時文件存儲在本地存儲中。經過一段時間後,我得到一個System.IO.IOException:磁盤上沒有足夠的空間。如何處理「System.IO.IOException:磁盤空間不足」。在Windows Azure中
所以我已經閱讀了一些關於它的文章和微軟自己建議趕上錯誤並嘗試清除文件。所以我現在的問題是如何完成這個最好的方法?
此刻,我會嘗試,但我不知道這是不是最好的辦法:
public static void ClearTempFolder(string localStorageName)
{
System.IO.DirectoryInfo downloadedMessageInfo = new DirectoryInfo(RoleEnvironment.GetLocalResource(localStorageName).RootPath);
foreach (FileInfo file in downloadedMessageInfo.GetFiles())
file.Delete();
foreach (DirectoryInfo dir in downloadedMessageInfo.GetDirectories())
dir.Delete(true);
}
感謝您的幫助。
thx爲您提供幫助! – MUG4N