- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 Dapr Azure Blob 存储绑定(bind)来设置文件存储
这是二头肌
存储帐户.bicep
@description('The location in which the Azure Storage resources should be deployed.')
param location string
@description('The name of the blob container.')
var containerName = 'ifms-filestore'
resource storageAccount 'Microsoft.Storage/storageAccounts@2022-05-01' = {
name: 'ifmsstorageaccount'
location: location
sku: {
name: 'Standard_LRS'
}
kind: 'BlobStorage'
properties: {
accessTier: 'Hot'
}
}
resource container 'Microsoft.Storage/storageAccounts/blobServices/containers@2022-05-01' = {
name: '${storageAccount.name}/default/${containerName}'
}
output storageAccountId string = storageAccount.id
output storageAccountApiVersion string = storageAccount.apiVersion
output storageAccountName string = storageAccount.name
output storageAccountContainerName string = container.name
blobstorage.bicep
param containerAppsEnvironmentName string
param storageAccountId string
param storageAccountApiVersion string
param storageAccountName string
param storageAccountContainerName string
resource containerAppsEnvironment 'Microsoft.App/managedEnvironments@2022-06-01-preview' existing = {
name: containerAppsEnvironmentName
resource daprComponent 'daprComponents@2022-03-01' = {
name: 'ifms-dapr-filestore'
properties: {
componentType: 'bindings.azure.blobstorage'
version: 'v1'
secrets: [
{
name: 'storage-account-account-key'
value: listKeys(storageAccountId, storageAccountApiVersion).keys[0].value
}
]
metadata: [
{
name: 'accountName'
value: storageAccountName
}
{
name: 'accountKey'
secretRef: 'storage-account-account-key'
}
{
name: 'containerName'
value: storageAccountContainerName
}
{
name: 'decodeBase64'
value: 'true'
}
]
scopes: [
'vehicle-management-web-api'
]
}
}
}
output daprPubSubName string = containerAppsEnvironment::daprComponent.name
AddFileAsync
是一个辅助函数,用于将文件添加到文件存储并使用 DaprtClinet 来执行此操作。
public async Task<FileReturnType> AddFileAsync(byte[] fileContent, string path, string fileName)
{
var filepath = Path.Combine(path, fileName);
string base64String = Convert.ToBase64String(fileContent, 0, fileContent.Length);
Dictionary<string, string> metadata = new Dictionary<string, string>{ {"blobName",filePath}};
await _daprClient.InvokeBindingAsync("ifms-dapr-filestore", "create", base64String, metadata);
long fileSize = fileContent.Length;
var extension = Path.GetExtension(fileName);
return new FileReturnType(filepath, fileSize, extension);
}
当我添加文件时,我收到以下错误消息
Dapr.DaprException: Binding operation failed: the Dapr endpoint indicated a failure. See InnerException for details.
---> Grpc.Core.RpcException: Status(StatusCode="Internal", Detail="error when invoke output binding ifms-dapr-filestore: error uploading az blob: -> github.com/Azure/azure-storage-blob-go/azblob.newStorageError, /home/vsts/work/1/go/pkg/mod/github.com/!azure/<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f5948f808790d886819a87949290d897999a97d8929ab583c5dbc4c5dbc5" rel="noreferrer noopener nofollow">[email protected]</a>/azblob/zc_storage_error.go:42
===== RESPONSE ERROR (ServiceCode=ContainerNotFound) =====
Description=The specified container does not exist.
RequestId:d12aeaa8-301e-0019-71b3-2d46c2000000
Time:2023-01-21T16:12:42.7329062Z, Details:
Code: ContainerNotFound
PUT https://ifmsstorageaccount.blob.core.windows.net/ifmsstorageaccount/default/ifms-filestore/RequestLetters/REQ-DIH-MUN-002/REQ-DIH-MUN-002%20-%20Request%20Letter.pdf?timeout=61
Authorization: REDACTED
Content-Length: [958932]
User-Agent: [dapr-1.9.5-msft-1 Azure-Storage/0.10 (go1.19; linux)]
X-Ms-Blob-Cache-Control: []
X-Ms-Blob-Content-Disposition: []
X-Ms-Blob-Content-Encoding: []
X-Ms-Blob-Content-Language: []
X-Ms-Blob-Content-Type: []
X-Ms-Blob-Type: [BlockBlob]
X-Ms-Client-Request-Id: [184d2673-814b-45ea-7ad0-cfe8d1fca4b3]
X-Ms-Date: [Sat, 21 Jan 2023 16:12:42 GMT]
X-Ms-Meta-Contenttype: [application/grpc]
X-Ms-Meta-Daprauthority: [127.0.0.1:50001]
X-Ms-Meta-Daprgrpcacceptencoding: [identity,gzip,deflate]
X-Ms-Meta-Traceparent: [00-cbed618718a728703a987fd1f50b6b25-c3d612101f033c57-00]
X-Ms-Meta-Useragent: [grpc-dotnet/2.47.0 (.NET 7.0.2; CLR 7.0.2; net6.0; linux; x64) dapr-sdk-dotnet/v1.9.0+3224579c3e136020bbf713528965854ebbd4eefe]
X-Ms-Version: [2019-02-02]
--------------------------------------------------------------------------------
RESPONSE Status: 404 The specified container does not exist.
Content-Length: [225]
Content-Type: [application/xml]
Date: [Sat, 21 Jan 2023 16:12:42 GMT]
Server: [Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0]
X-Ms-Client-Request-Id: [184d2673-814b-45ea-7ad0-cfe8d1fca4b3]
X-Ms-Error-Code: [ContainerNotFound]
X-Ms-Request-Id: [d12aeaa8-301e-0019-71b3-2d46c2000000]
X-Ms-Version: [2019-02-02]
最佳答案
我认为问题出在您的 storageAccountContainerName
中,查看错误响应似乎采用 {storageaccountName}/default/{actualContainerName}
的格式。
输出中 PUT 请求中的 URL 以 https://ifmsstorageaccount.blob.core.windows.net/ifmsstorageaccount/default/ifms-filestore/
开头,格式为 https://{storageAccountName}.blob.core.windows.net/{storageAccountName}/default/{containerName}/{blobName}
而应该是 https://{storageAccountName}.blob .core.windows.net/{containerName}/{blobName}
尝试将 storageaccount.bicep 中的输出更改为:
output storageAccountContainerName string = last(split(container.name, '/'))
关于c# - Azure:指定的容器不存在,Dapr 与 ContainerApps,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/75194547/
我部署了一个带有单个修订版本的 Azure ContainerApp,我想停止它 - 但不删除它,并且必须重新部署它。我在注册表中看到该镜像,并且可以通过门户选择将其部署到 AppService 或
我部署了一个带有单个修订版本的 Azure ContainerApp,我想停止它 - 但不删除它,并且必须重新部署它。我在注册表中看到该镜像,并且可以通过门户选择将其部署到 AppService 或
在 Azure ContainerApps 文档中 Ports and IP Addresses section它表明 Outbound public IP Used as the "from" I
我正在通过 CLI 使用 Azure ContainerApps。 我正在尝试使用 CLI 检查我的容器应用程序中允许的入口流量设置(允许所有流量/仅限于 VNet/仅限于容器应用程序环境)。 执行
我有一个通过二头肌脚本使用默认公共(public)图像构建的容器应用程序。我将系统管理的身份分配给容器应用程序。我已将 AcrPull 角色分配给 ACR 私有(private)注册表 上的身份 AC
我正在使用 Dapr Azure Blob 存储绑定(bind)来设置文件存储 这是二头肌 存储帐户.bicep @description('The location in which the Azu
我正在使用 DevOps 管道来更新容器应用程序。 DevOps 管道使用自托管代理池,该池使用 VMSS 代理。在管道 cli 任务中,我使用 az cli 命令为容器应用程序创建系统分配的托管标识
我正在使用它来创建一个 azure 容器应用程序 az containerapp create -n sample -g my-container-app-env --image sampleapi-
我是一名优秀的程序员,十分优秀!