Azure云服务磁盘上没有足够的空间

hyp*_*erN 1 azure azure-cloud-services

我一直在收到错误: Exception Details: System.IO.IOException: There is not enough space on the disk.

我知道这种情况正在发生,因为当用户访问我的页面时,他/她的zip文件被下载然后解压缩.每个zip大约45 MB,解压缩大约50 MB.我在几次访问页面后开始收到此错误(我相信下载1 GB时)并在本地保存到Cloud Service光盘

我在Azure上运行此作为Cloud Service,服务的大小为中:

本地资源= 489 GB Apps =约.1.5 GB

有什么办法可以增加光盘的大小,所以我可以节省50 GB吗?

编辑

以下是我收到错误的代码的一部分:

using (var client = new WebClient())
        {
            client.DownloadFile(link, HostingEnvironment.MapPath("~/ebookDownloads/" + name));


            using (ZipFile zip = ZipFile.Read(HostingEnvironment.MapPath("~/ebookDownloads/" + name)))
            {
                foreach (var e in zip)
                {
                    e.Extract(folderToCreate, ExtractExistingFileAction.OverwriteSilently); // overwrite == false
                    // var filePath = HttpContext.Server.MapPath("~/ebookDownloads/" + nameOfFolder + "/" + e.FileName);
                    var filePath = Path.Combine(Server.MapPath("~/ebookDownloads/" + nameOfFolder), e.FileName);
                    listOfLinks.Add(new EbooksHelper { Name = e.FileName, Size = BytesToString(new FileInfo(filePath).Length), Url = "/platinum/DownloadEbook?name=" + e.FileName });
                    var y = e;
                }          
            }
        }
Run Code Online (Sandbox Code Playgroud)

Mar*_*tin 5

您可以使用本地存储资源,这些资源会添加到服务定义中,例如:

<ServiceDefinition>
  <WebRole name="MyService_WebRole" vmsize="Medium">
    <LocalResources>
      <LocalStorage name="LocalStorageName" sizeInMB="50000" cleanOnRoleRecycle="false" />
    </LocalResources>
  </WebRole>
</ServiceDefinition>
Run Code Online (Sandbox Code Playgroud)

要从运行时访问本地存储,您将RoleEnvironment.GetLocalResource(name)能够获得本地存储的路径.

var localResource = RoleEnvironment.GetLocalResource("LocalStorageName");
var rootPath = localResource.RootPath
Run Code Online (Sandbox Code Playgroud)