加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

Azure 基础:File Storage

发布时间:2020-12-15 08:16:13 所属栏目:安全 来源:网络整理
导读:https:// .file.core.windows.net/ / / https://nickdemo.file.core.windows.net/demofiles/temp.txt CloudStorageAccount storageAccount = CloudStorageAccount.Parse( span style="color: #008000"// span style="color: #008000"CloudFileClient 类是 Wi

https://.file.core.windows.net///

https://nickdemo.file.core.windows.net/demofiles/temp.txt

CloudStorageAccount storageAccount = CloudStorageAccount.Parse(<span style="color: #008000">// <span style="color: #008000">CloudFileClient 类是 Windows Azure File Service 客户端的逻辑表示,我们需要使用它来配置和执行对 File Storage 的操作。
CloudFileClient fileClient =<span style="color: #000000"> storageAccount.CreateCloudFileClient();
<span style="color: #008000">//
<span style="color: #008000">CloudFileShare 表示一个 File Share 对象。

CloudFileShare share =<span style="color: #000000"> fileClient.GetShareReference(shareName);
<span style="color: #008000">//
<span style="color: #008000">如果不存在就创建 File Share。
share.CreateIfNotExists();

CloudFileDirectory rootDir = CloudFileDirectory webDir = rootDir.GetDirectoryReference( CloudFile cloudFile = webDir.GetFileReference( localFile = <span style="color: #0000ff">using (<span style="color: #0000ff">var fileStream =<span style="color: #000000"> System.IO.File.OpenRead(localFile))
{
<span style="color: #008000">//
<span style="color: #008000">上传文件。

<span style="color: #000000"> cloudFile.UploadFromStream(fileStream);
}

CloudFileShare share === rootDir.GetDirectoryReference(CloudFile cloudFile = webDir.GetFileReference(<span style="color: #800000">"<span style="color: #800000">web.log<span style="color: #800000">"<span style="color: #000000">);
<span style="color: #0000ff">if
<span style="color: #000000"> (cloudFile.Exists())
{
<span style="color: #008000">//<span style="color: #008000">由 web.log 文件创建 web.copy.log 文件。
CloudFile copyFile = webDir.GetFileReference(<span style="color: #800000">"<span style="color: #800000">web.copy.log<span style="color: #800000">"<span style="color: #000000">);
copyFile.StartCopy(cloudFile);
}

share.Properties.Quota =

cmdkey /add:.file.core.windows.net /user: /pass: net use z: .file.core.windows.netmylogs

和 < storage-account-key >进行替换。

net use z: .file.core.windows.netmylogs

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读