在 Azure 网站上的何处保存/提取文件?

Where to save/extract files on Azure Web Sites?(在 Azure 网站上的何处保存/提取文件?)

本文介绍了在 Azure 网站上的何处保存/提取文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用于对我们的数据运行单元测试的 Web 应用程序,我想将其部署为 Azure 网站.
问题出在这个应用中我正在下载相当大的 zip 文件,将它们解压缩(约 50MB,里面有 500 个文件)并对这些文件进行一些测试.
我应该将这些大文件保存在 Azure 网站上的什么位置,应该在哪里提取它们?在本地主机上,我一直在使用Path.GetTempPath()",但 Azure 网站报告此文件夹中没有空间,即使我的 Azure 站点总共有 1000MB 和大约 990MB 可用空间.
有什么办法可以将这 1000MB 用于我的文件操作?
如果无法做到这一点,我是否应该将 Azure Blob 存储用于提取的文件?

I have web application for running unit tests for our data and I want to deploy it as Azure Web Site.
The problem is in this app I'm downloading quite large zip files, extracting them (~50MB, 500 files inside) and doing some tests over these files.
Where should I save these large files on Azure Web Sites and where hould I extract them? On localhost I've been using "Path.GetTempPath()", but Azure Web Site is reporting that there is no space in this folder, even though my Azure Site has 1000MB total and about 990MB free.
Is there any way how to use these 1000MB for my file operations?
In case this is not possible, should I use the Azure Blob Storage for the extracted files?

推荐答案

如果是网站,并且当您的存储要求符合提供的本地存储的限制时 - 您当然可以使用本地存储.

In case of Web Sites and when your storage requirements fit withing the constraints of provided local storage - you certainly can use local storage.

但是 Path.GetTempPath() 不是 Azure 网站的最佳选择.我想说你应该把所有文件放在一个文件夹中,该文件夹是你的 web 应用根文件夹的一部分,即 Server.MapPath("~/tmp/").确保首先检查文件夹是否存在等.在那里您可以利用您拥有的所有存储空间.

However Path.GetTempPath() is not your best choice for Azure Web Site. I would say you shall put all the files in a folder which is part of your web app root folder, i.e. Server.MapPath("~/tmp/"). Make sure to first check for folder existence, etc. There you can utilize all the storage you have.

至于 Blob - 您必须分别解压缩每个文件并将其单独上传到 Blob.当您必须处理这些文件时,您必须再次下载它们.我不认为这是真正的解决方案,只要您有足够的本地存储空间即可使用.

As for Blob - you have to unzip each file separately and upload it separately to a blob. And when you have to work with the files, you have to download them again. I don't believe this is real solution, as long as you have enough local storage you can utilize.

这篇关于在 Azure 网站上的何处保存/提取文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:在 Azure 网站上的何处保存/提取文件?

基础教程推荐