我需要临时存储我的Azure Web应用程序(应用程序服务)上的文件.我不必在Web应用程序实例之间共享这些文件.
我已经读过(在kudu wiki中)我可以使用d:\ local进行这样的存储,但是有哪些数据可以存储在那里?
我还读到它取决于网络应用程序的选定级别(sku)(基本,标准,高级),但我没有找到任何确切的大小限制.
有没有办法在运行时使用代码确定这个?
更新:
当我在我的基本Web应用程序中检查Kudo中的Environment选项卡时,它会列出
D:\home usage: 10,240 MB total; 10,072 MB free
d:\local usage: 230,397 MB total; 198,341 MB free
Run Code Online (Sandbox Code Playgroud)
但是,如果我使用System.IO.DriveInfo.GetDrives()D驱动器列表进行检查
d:\ usage: 32,768 MB total; 12,083 MB free
Run Code Online (Sandbox Code Playgroud)
(工藤显示出比为d多了很多:\本地驱动器),
另一个奇怪的事情是,你可以浏览在工藤控制台中的文件系统,但是我的web应用程序创建无法在那里找到的文件.
我正在使用Azure存储来保存一些文件。我希望这些文件可以暂时公开。目前,我正在通过azure存储文件服务保存它们。每个文件都具有结构./ [文件共享] / [目录] / [文件名]。[ext]的URL。
我的问题是,有没有办法使此URL公开可用?我没有办法。如果没有,是否有一些建议的方法可以使文件公开可用?我看不到通过文件服务执行此操作的方法。
到目前为止,我得到了一个句柄CloudFileDirectory,调用此方法给了我一个IListFileItem对象列表, 给定对象中的每个文件和目录为1个对象CloudFileDirectory,但是我很难区分哪个文件和哪个目录。
在IListFileIteminclude 上可用的属性Uri是一个System.Uri具有isFile成员的对象,但这对于我的文件和目录显示为false。
我需要获取我可以钻取的目录列表,可以使用的文件列表,但是到目前为止,我还没有找到一种方法来过滤此混合列表。
我想不出值得混合使用的清单。我不知道为什么M $没有暴露ListFiles,并ListDirectories作为单独的方法。也许他们很难区分他们并放弃了。
我正在尝试在 Fedora 22 上编译 Azure 存储 c++ SDK。我使用的是 gcc 版本 5.1.1-1。当我使用以下命令编译测试应用程序时:
$> CASABLANCA_DIR=/source/codebox/azure/cpprestsdk/ CXX=g++ cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=on
$> make
Run Code Online (Sandbox Code Playgroud)
它会产生以下错误消息:
/usr/bin/ld: CMakeFiles/azurestoragetest.dir/main.cpp.o: undefined reference to symbol 'pthread_rwlock_wrlock@@GLIBC_2.2.5'
/usr/lib64/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
tests/CMakeFiles/azurestoragetest.dir/build.make:879: recipe for target 'Binaries/azurestoragetest' failed
make[2]: *** [Binaries/azurestoragetest] Error 1
CMakeFiles/Makefile2:125: recipe for target 'tests/CMakeFiles/azurestoragetest.dir/all' failed
make[1]: *** [tests/CMakeFiles/azurestoragetest.dir/all] Error 2
Makefile:126: recipe for target 'all' failed
make: *** [all] Error 2
Run Code Online (Sandbox Code Playgroud)
我可以在/usr/lib64目录中看到libpthread.so.0 …
快速提问。我一直在阅读大量有关azure blob /文件/磁盘存储选项的信息,并且我对存储的要求如此简单,因此我对最佳选择感到困惑。我正在阅读的大多数信息完全笼罩着我。
我希望有人可以将视野缩小到更合理大小的一组优点/缺点。我的情况如下:
我正在建立一个进行图像处理的API。简而言之,用户请求获取具有特定文本的特定图像以打印在顶部,我的API对其进行处理并将其吐出。目前,我正在Azure模拟器上运行,因此图像文件(大约3演出的PNG)是从本地路径中提取的。我很快将部署到实时的Azure服务器上,因此我想将这些图像文件存储在某个位置(而不将它们放置在实际的应用程序文件中)。
到目前为止,我的理解是磁盘和文件选项将使我可以使代码保持相对不变,同时仍使用常规文件I / O来加载映像路径。磁盘将仅允许对运行此API的计算机进行数据访问,这很好,但是我不知道使用磁盘是否有任何好处,这会施加此限制。Blob存储将要求我更改此设置,但是没有太多代码,并且我不认为这会太困难。
每个不同选择的细节太多,以至于我难以做出决定:就我的情况而言,这三个之间是否有明确的选择?它归结为更容易的事情吗?性能和成本是重中之重,那么在这些方面的利弊是什么?这确实需要能够缩放到更多图像,但只能缩放到一定程度。我可以看到,在接下来的几年中,它的数量将从3个演出增加到10个演出,但不会从3个演出增加到1000个演出。
.net azure azure-storage azure-storage-blobs azure-storage-files
我必须在同一存储帐户上的共享和blob之间移动一些文件.经过一些谷歌搜索后我得到了这段代码:
CloudFileClient fileClient = account.CreateCloudFileClient();
CloudFileShare share = fileClient.GetShareReference("shareName");
CloudFileDirectory rootDir = share.GetRootDirectoryReference();
CloudFileDirectory videoDirectory = rootDir.GetDirectoryReference(video.StoragePath);
CloudBlobClient blobClient = account.CreateCloudBlobClient();
CloudBlobContainer container = blobClient.GetContainerReference(video.StoragePath);
container.CreateIfNotExists();
foreach (var Files in videoDirectory.ListFilesAndDirectories())
{
var arr = Files.Uri.ToString().Split('/');
string strFileName = arr[arr.Length - 1];
CloudFile sourceFile = videoDirectory.GetFileReference(strFileName);
string fileSas = sourceFile.GetSharedAccessSignature(new SharedAccessFilePolicy()
{
Permissions = SharedAccessFilePermissions.Read,
SharedAccessExpiryTime = DateTime.UtcNow.AddHours(24)
});
Uri fileSasUri = new Uri(sourceFile.StorageUri.PrimaryUri.ToString() + fileSas);
CloudBlockBlob blockBlob = container.GetBlockBlobReference(strFileName);
blockBlob.StartCopyAsync(fileSasUri).Wait(); //copy the file to blob storage and wait for …Run Code Online (Sandbox Code Playgroud) 我尝试使用最新模拟器 (5.9) 来使用 FileClient for Azure Storage,但出现以下异常:No file endpoint configured.
这是我的代码:
if (CloudStorageAccount.TryParse("UseDevelopmentStorage=true", out var account))
_fileClient = account.CreateCloudFileClient();
Run Code Online (Sandbox Code Playgroud)
任何帮助,将不胜感激。
azure azure-storage azure-storage-emulator azure-storage-files
我正在编写一个 Python 脚本来从 Azure 文件共享下载文件。文件共享的结构如下:
/analytics/Part1/file1.txt
/analytics/Part1/file2.txt
/analytics/mainfile.txt
/analytics/Part1/Part1_1/file11.txt
Run Code Online (Sandbox Code Playgroud)
我尝试在脚本中使用以下几行,但它仅在根目录级别查找文件和目录。
/analytics/Part1/file1.txt
/analytics/Part1/file2.txt
/analytics/mainfile.txt
/analytics/Part1/Part1_1/file11.txt
Run Code Online (Sandbox Code Playgroud)
输出是:
/analytics/mainfile.txt --> File
/analytics/Part1 --> Dir
Run Code Online (Sandbox Code Playgroud)
但是,我正在寻找类似os.walk()Python 中的函数的东西来实现这种递归目录遍历。知道 Azure 文件服务 Python API 中是否提供此类功能吗?
我正在尝试将文件上传到我的 Azure 文件存储帐户。
这是我的代码:
CloudStorageAccount storageAccount = CloudStorageAccount.Parse("myConnString");
CloudFileClient fileClient = storageAccount.CreateCloudFileClient();
CloudFileShare share = fileClient.GetShareReference("myFileStorage");
if (await share.ExistsAsync())
{
CloudFileDirectory rootDir = share.GetRootDirectoryReference();
CloudFileDirectory sampleDir = rootDir.GetDirectoryReference("/folder1/folder2/");
CloudFile file = sampleDir.GetFileReference("fileName.jpg");
using Stream fileStream = new MemoryStream(data);
await file.UploadFromStreamAsync(fileStream);
}
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
指定的父路径不存在。
在这一行之后:
CloudFile file = sampleDir.GetFileReference("fileName");
Run Code Online (Sandbox Code Playgroud)
在file有这个URI:
https://myFileStorage.file.core.windows.net/myFileStorage/folder1/folder2/fileName.jpg
Run Code Online (Sandbox Code Playgroud)
即正如预期的那样。
目前我的文件存储是空的,没有文件/文件夹。如果自定义文件夹尚不存在,如何创建它们?
我在使用cURL创建新的/简单的PHP脚本/函数时遇到问题,无法使用共享密钥身份验证将简单文件(image.jpg)从本地服务器上传到Azure存储-Blob容器。我不希望(由于其他原因)使用SDK和/或多个文件/库。我只需要一个功能-fileUpload-就是这样。
文档没有提供带有文件覆盖的上载(POST)的完整示例。 https://docs.microsoft.com/zh-cn/rest/api/storageservices/fileservices/authentication-for-the-azure-storage-services
同样不清楚的是,必须具有哪些标头,以及签名/身份验证属性具有哪些标头。(例如,具有不同标题的多个MSDN站点-https: //docs.microsoft.com/zh-cn/rest/api/storageservices/fileservices/put-blob
有人对此想分享一个简单的例子吗?
<?php
error_reporting(E_ALL);
ini_set('display_errors', 'On');
date_default_timezone_set('UTC');
$destinationURL = 'https://mystorage.blob.core.windows.net/blob1/image.jpg';
$accesskey = "qJXTMmw2Esal8/tXgfWk0RLwMNJ6OQKEt0E8EMZ8VhQrzGi5uqJqeKvi1l7iqnOddp7bdtai5rPpC6ynHttl1w==";
$storageAccount = 'mystorage';
$filetoUpload = realpath('./image.jpg');
function upload($filetoUpload, $storageAccount,$destinationURL,$accesskey) {
$currentDate = date("D, d M Y H:i:s");
$postFields = array(
'extra_info' => '123456',
'file_contents'=>'@'.$filetoUpload
);
$headerText=""
."x-ms-version: 2015-02-21\n"
."x-ms-date:" .$currentDate." GMT\n"
."Content-Type: text/plain; charset=UTF-8\n"
."x-ms-blob-content-disposition: attachment; filename=".$filetoUpload."\n"
."x-ms-blob-type: BlockBlob\n"
."x-ms-meta-m1: v1\n"
."x-ms-meta-m2: v2\n"
;
$hash = hash_hmac('sha256', $headerText, base64_decode($accesskey), true);
$sig = base64_encode($hash);
$headerText.="Authorization: SharedKey ".$storageAccount.":".$sig."\n";
$headerText.="Content-Length: 280";
$headers = explode("\n", $headerText);
$ch …Run Code Online (Sandbox Code Playgroud) 我想通过python Request访问我的文件服务,在列表共享页面的引导下,我是REST和python Request的新手。我的输入是
headers= {'x-ms-date': '2018-04-17 06:22:15.181620', 'Authorization': 'SharedKey zedongstorageaccount:codecodecodeFiTzubX9tvC3G3PcDYzR2cX/TMjkOu4JhsvQffS+xTDDBQ==', 'x-ms-version': '2017-07-29'}
url = 'https://zedongstorageaccount.file.core.windows.net/?comp=list'
r=requests.get(url,headers=headers)
Run Code Online (Sandbox Code Playgroud)
但是得到错误,r.content的输出:
b'\xef\xbb\xbf<?xml version="1.0" encoding="utf-8"?><Error><Code>AuthenticationFailed</Code><Message>Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.\nRequestId:ef98f282-f01a-0042-3e24-d62397000000\nTime:2018-04-17T08:16:21.9635335Z</Message><AuthenticationErrorDetail>The Date header in the request is incorrect.</AuthenticationErrorDetail></Error>'
Run Code Online (Sandbox Code Playgroud)
我也尝试过标题{'x-ms-date': '2018-04-17 06:22:15.181620', 'Authorization': 'SharedKey zedongnewstorageaccount:NJYYtabOIj5D1R+xb0PpmXrjCldf6NA6oLkYReAKFiTzubX9tvC3G3PcDYzR2cX/TMjkOu4JhsvQffS+xTDDBQ==', 'x-ms-version': '2017-07-29'},因为我不知道Authorization和是否account在同一行中。我还尝试了许多版本x-ms-version。但是所有400或403响应。
错误在哪里?是否可以通过Azure REST API来构建我的应用程序?(我使用google关键字,所有页面都涉及到构建REST API和azure官方文档)
rest azure azure-storage python-requests azure-storage-files
我已经创建了 Azure blob 存储,现在我想将文件推送到存储以进行身份验证,需要使用客户端证书。
知道怎么做吗?