gpt4 book ai didi

c# - 使用 C# 示例使用 Coldfusion 通过 REST 访问 Azure blob 存储

转载 作者:太空宇宙 更新时间:2023-11-03 11:14:10 25 4
gpt4 key购买 nike

我在尝试如何列出所有容器和 blob 时遇到了困难。奇怪的是,我还没有看到一个这样做的 Coldfusion 示例。

我试过关注一个 C# 项目,但我在创建签名时遇到了困难。以下是我到目前为止从 C# 项目中提取的内容。

资源数组 - 这些是我想调用的一些资源

  1. restype=container&comp=list&include=snapshots&include=metadata
  2. 比较=列表
  3. 容器 + "/"+ blob + "?comp=pagelist
  4. 容器 + "/"+ blob + "?comp=blocklist

我从 C# 逻辑中提取的内容

<cfhttp method="GET" url="http://#arguments.storageAccount#.#variables.hostEndPoint[storageType]#?#resource[1]#">
<cfhttpparam type="header" name="x-ms-date" value="#dateTimeString#" />
<cfhttpparam type="header" name="x-ms-version" value="2009-09-19" />
<cfhttpparam type="header" name="Authorization" value="??????" />
</cfhttp>

由于我不是 C# 开发人员,如果有人可以解释以下结果会是什么,我也许可以转换它。

MessageSignature 是否是以下值的逗号分隔列表(即 '{0}\n\n\n{1}\n{5}\n\n\n\n{2}\n\n\n\n{3}{4},GET,,无论 ifMatch 返回什么,...')

MessageSignature = String.Format("{0}\n\n\n{1}\n{5}\n\n\n\n{2}\n\n\n\n{3}{4}",
method,
(method == "GET" || method == "HEAD") ? String.Empty : request.ContentLength.ToString(),
ifMatch,
GetCanonicalizedHeaders(request),
GetCanonicalizedResource(request.RequestUri, StorageAccount),
md5
);

以下示例字符串将返回什么(例如“Complex Azure!”)

    byte[] SignatureBytes = System.Text.Encoding.UTF8.GetBytes(MessageSignature);

谢谢。

最佳答案

我不久前尝试使用 Coldfusion 的 REST API,但没有取得太大成功,所以我无法直接回答您的问题(我也无法获得正确的签名)。但是,Microsoft 现在完全支持 Azure Java SDK它使用 REST API,这应该可以从 Coldfusion 中使用(尽管我还没有机会尝试 - 尽管我完全打算尝试)。

关于c# - 使用 C# 示例使用 Coldfusion 通过 REST 访问 Azure blob 存储,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13167534/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com