标签: azurite

集成了 azurite 的 Visual studio 2022 (v3.14.1) 在创建本地 blob 容器时给出错误消息 InvalidHeaderValue

这是抛出的错误:

Headers:
Server: Azurite-Blob/3.14.1
x-ms-error-code: InvalidHeaderValue
x-ms-request-id: a3aca2f1-c0af-4af5-a54c-d7e24c188ba0
Date: Mon, 21 Mar 2022 13:22:04 GMT
Connection: keep-alive
Keep-Alive: REDACTED
Transfer-Encoding: chunked
Content-Type: application/xml

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <Error>
    <Code>InvalidHeaderValue</Code>
     <Message>The value for one of the HTTP headers is not in the correct format.
    RequestId:a3aca2f1-c0af-4af5-a54c-d7e24c188ba0
    Time:2022-03-21T13:22:04.189Z</Message>
    <HeaderName>x-ms-version</HeaderName>
    <HeaderValue>2021-04-10</HeaderValue>
    </Error>
Run Code Online (Sandbox Code Playgroud)

如果我查看 Github:https://github.com/Azure/Azurite并阅读以下描述:

API版本兼容策略

如果传入请求的 API 版本高于 Azurite,Azurite 将返回 x-ms-version 的 InvalidHeaderValue 错误(HTTP 状态代码 400 - 错误请求)。

什么可以是正确的,因为在 api 错误消息中它声称有一个 headervalue : HeaderValue: 2021-04-10 (Azurite 的最新 api 版本 3.16.0 是什么,请参阅 github)。如果您再次查看标题中的错误,则为 …

azure azurite

14
推荐指数
2
解决办法
8494
查看次数

Azure Functions:Blob 存储模拟器在迁移到 VS2022 后停止工作

我有一个旧的 Azure Functions 项目 (v3)。它包含几个定时器触发的函数。他们停止了 VS2022 的工作。您可以看到下面的日志。如果我通过 VS2022 创建一个新的 Functions 项目,它将正常工作。看起来蓝铜矿也启动得很好。设置“AzureWebJobsStorage”等于“UseDevelopmentStorage=true”。我能做些什么?

[2022-01-06T10:17:15.675Z] Host lock lease acquired by instance ID '000000000000000000000000DC2A3C3E'.
[2022-01-06T10:17:35.554Z] The listener for function 'Function1' was unable to start.
[2022-01-06T10:17:35.556Z] The listener for function 'Function1' was unable to start. Azure.Storage.Blobs: Service request failed.
[2022-01-06T10:17:35.557Z] Status: 500 (Internal Server Error)
[2022-01-06T10:17:35.557Z]
[2022-01-06T10:17:35.558Z] Headers:
[2022-01-06T10:17:35.559Z] Server: Azurite-Blob/3.14.1
[2022-01-06T10:17:35.560Z] ETag: "0x234B8B049DD4280"
[2022-01-06T10:17:35.561Z] x-ms-blob-type: BlockBlob
[2022-01-06T10:17:35.562Z] x-ms-lease-state: available
[2022-01-06T10:17:35.562Z] x-ms-lease-status: unlocked
[2022-01-06T10:17:35.563Z] x-ms-client-request-id: a3bc0141-7bcb-420c-84a9-eadf86f8c685
[2022-01-06T10:17:35.564Z] x-ms-request-id: 88474d4b-bc15-4f45-95d5-0a01682d883d
[2022-01-06T10:17:35.565Z] x-ms-version: 2020-10-02
[2022-01-06T10:17:35.566Z] Accept-Ranges: bytes …
Run Code Online (Sandbox Code Playgroud)

azure azure-functions azurite visual-studio-2022

9
推荐指数
1
解决办法
8023
查看次数

如何使用 Azurite blob 容器作为 Azure Function 内部存储和触发器?

我已按照说明下载并安装适用于 Linux (Ubuntu 18.04) 的 Azurite。我想将其与 Azure 存储资源管理器(也已下载并安装)一起使用,以通过 BlobTrigger 直观地管理/测试 Azure Function。我了解如何启动 Azurite,并可以使用 Storage Exporer 将 blob 上传到模拟器容器。

无法弄清楚:

  1. 如何将 Azure Function 连接到 Azurite 容器以用作 Functions内部存储。

    A。我"AzureWebJobsStorage": "UseDevelopmentStorage=true"在 中使用过local.settings.json,但我不知道如何将函数连接到 Azurite 中的给定容器

  2. 如何将函数连接到 Azurite 容器以实现BlobTrigger功能。

    A。我需要添加"BlobTrigger": "<azuriteContainerConnectionString>"设置吗local.settings.json

azure-functions azure-storage-explorer azurite

8
推荐指数
1
解决办法
8014
查看次数

有没有办法在启动 Azurite 时自动创建容器?

出于测试目的,我在测试管道中创建并运行 Azurite docker 映像。我希望在 Azurite 启动后自动创建 blob 容器,因为这会简化事情。

有什么好的方法可以达到这个目的吗?

对于我们使用的 Postgres 映像,我们可以指定一个在启动时运行的 init.sql。如果蓝铜矿也有类似的东西,那就太棒了。

azurite

7
推荐指数
1
解决办法
3483
查看次数

无法在 VS Code IDE 中调试 Python Azure 函数。获取连接 ECONNREFUSED 127.0.0.1:9091 错误

我正在尝试使用 VS code IDE 调试 Azure 函数 python 代码。
Local.settings.json 使用以下配置更新

"AzureWebJobsStorage": "UseDevelopmentStorage=true"
Run Code Online (Sandbox Code Playgroud)

到目前为止我尝试过的事情:-

  • 我重新安装了VS代码,
  • 将 Azure Function Core 工具从 4.0 降级到 3.0
  • 任何解决这个问题的指示都会非常有帮助。

以下是尝试调试用 Python 编写的 Azure 函数时 VS Code IDE 上的错误:

在此输入图像描述

下面的Host.json

{
  "version": "2.0",
  "logging": {
    "applicationInsights": {
      "samplingSettings": {
        "isEnabled": true,
        "excludedTypes": "Request"
      }
    }
  },
  "extensionBundle": {
    "id": "Microsoft.Azure.Functions.ExtensionBundle",
    "version": "[2.*, 3.0.0)"
  },
  "functionTimeout": "20:00:00",
  "extensions": {
    "durableTask": {
      "maxConcurrentActivityFunctions": 1
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

下面是launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Attach to Python …
Run Code Online (Sandbox Code Playgroud)

visual-studio-code azure-functions azure-functions-runtime azure-functions-core-tools azurite

7
推荐指数
1
解决办法
9706
查看次数

尝试为 (Azurite) Azure BLOB 存储生成 SAS URI 时,“服务器无法验证请求”

我已经梳理了这个问题的至少十几个不同版本,但到目前为止,没有一个版本能给出我所遇到的问题的答案。我正在尝试开发一个概念验证,用于使用 Azurite 和具有相应存储帐户密钥的服务 SAS 从 Azure BLOB 存储检索图像。我正在使用众所周知的 Azurite 存储帐户凭据,如此处所示。在 C# 中似乎有无数种方法可以完成此类操作,但我选择宽松地遵循此示例,最终得到如下结果:

public Uri GetSharedKeySasUrl()
{
    BlobServiceClient serviceClient = new BlobServiceClient(
        new Uri("http://127.0.0.1:10000/devstoreaccount1/"),
        new Azure.Storage.StorageSharedKeyCredential(
            "devstoreaccount1",
            "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw=="
        )
    );

    var blobContainer = serviceClient.GetBlobContainerClient("images");

    var blobClient = blobContainer.GetBlobClient("00000-pano.jpg");

    BlobSasBuilder sasBuilder = new BlobSasBuilder()
    {
        BlobContainerName = "images",
        BlobName = "00000-pano.jpg",
        Resource = "b",
        StartsOn = DateTimeOffset.UtcNow,
        ExpiresOn = DateTimeOffset.UtcNow.AddHours(1)
    };

    sasBuilder.SetPermissions(BlobSasPermissions.Read);

    Uri sasUri = blobClient.GenerateSasUri(sasBuilder);
    Debug.WriteLine("SAS URI for blob is: {0}", sasUri);

    return sasUri;
}
Run Code Online (Sandbox Code Playgroud)

这会生成一个看起来应该可以正常工作的URL …

.net c# azure-blob-storage azurite

7
推荐指数
2
解决办法
2736
查看次数

使用 Azurite 的 Azure 存储资源管理器中出现错误:第一个参数必须是字符串类型或 Buffer 实例

我正在本地从 VSCode 运行一个 Azure 函数,该函数将字符串输出到 blob。我正在使用 Azurite 来模拟输出 blob 容器。我的函数如下所示:

import azure.functions as func

def main(mytimer: func.TimerRequest, outputblob:func.Out[str]):
    outputblob.set("hello")
Run Code Online (Sandbox Code Playgroud)

我的 function.json:

{
  "scriptFile": "__init__.py",
  "bindings": [
    {
      "name": "mytimer",
      "type": "timerTrigger",
      "direction": "in",
      "schedule": "0 * * * * *"
    },
    {
      "name": "outputblob",
      "type": "blob",
      "dataType": "string",
      "direction": "out",
      "path": "testblob/hello"
    }
  ]
}
Run Code Online (Sandbox Code Playgroud)

在 local.settings.json 中,我设置了"AzureWebJobsStorage": "UseDevelopmentStorage=true".

问题是,当我运行该函数并签入 Azure 存储资源管理器时,会创建容器 (testblob)(以及其他 2 个容器:azure-webjobs-hosts 和 azure-webjobs-secrets),但它是空的并且 Azure 存储资源管理器刷新时显示错误消息: 第一个参数必须是字符串类型或 Buffer、ArrayBuffer、Array 或类似 Array 的实例。Received undefined

该函数运行并且不返回任何错误消息。

当我使用队列而不是 blob …

python azure-storage azure-functions azure-storage-explorer azurite

4
推荐指数
1
解决办法
1372
查看次数

通过 Docker 从 .NET 应用程序连接到 Azurite

我有一个 .NET 6 API(在 Docker 中运行)和 Azurite(在 Docker 中运行)。

我尝试使用 .NET SDK 从 .NET 应用程序连接到 Azurite,但在 Docker 日志中收到以下错误:

System.AggregateException: 6 次尝试后重试失败。可以在 ClientOptions.Retry 中调整重试设置。(连接被拒绝(蓝铜矿:10000))(连接被拒绝(蓝铜矿:10000))(连接被拒绝(蓝铜矿:10000))(连接被拒绝(蓝铜矿:10000))(连接被拒绝(蓝铜矿:10000))(连接被拒绝(蓝铜矿:10000))(连接被拒绝(蓝铜矿:10000)) :10000))

它在第二行 ( CreateIfNotExists()) 处即将消失:

_blobContainerClient = new BlobContainerClient(connectionString, containerName);
_blobContainerClient.CreateIfNotExists();
Run Code Online (Sandbox Code Playgroud)

这是我的 .NET 应用程序中的连接字符串:

"Azure": {
        "StorageConnectionString": "UseDevelopmentStorage=true"
    }
Run Code Online (Sandbox Code Playgroud)

这是我的docker-compose.yml文件:

version: '3.4'

services:
  api:
    image: ${DOCKER_REGISTRY-}api
    container_name: aft-backend-api
    build:
      context: src
      dockerfile: API/Dockerfile    
    networks:
      - aft-backend
    environment:
      - ASPNETCORE_URLS=http://+:5000
      - Azure__StorageConnectionString=UseDevelopmentStorage=true;DevelopmentStorageProxyUri=http://azurite;
    depends_on:
      - azurite
  azurite:
    image: mcr.microsoft.com/azure-storage/azurite
    container_name: aft-backend-azurite
    hostname: azurite
    restart: always
    command: …
Run Code Online (Sandbox Code Playgroud)

.net docker docker-compose azurite

2
推荐指数
2
解决办法
6802
查看次数

每次重新启动计算机时 AzureWebJobStorage 都会出错

当我重新启动计算机后启动我的 azure 函数项目时,出现以下错误。我已经通过删除 Azure 存储中的文件来解决这个问题,但我想知道这里发生了什么以及如何修复该错误。

[2022-03-04T16:51:23.517Z] There was an error performing a read operation on the Blob Storage Secret Repository. Please ensure the 'AzureWebJobsStorage' connection string is valid.
[2022-03-04T16:51:23.671Z] A host error has occurred during startup operation '8f35a704-d86a-4e33-947d-09d099cc767f'.
[2022-03-04T16:51:23.673Z] Azure.Storage.Blobs: Service request failed.
[2022-03-04T16:51:23.674Z] Status: 500 (Internal Server Error)
[2022-03-04T16:51:23.675Z]
[2022-03-04T16:51:23.675Z] Headers:
[2022-03-04T16:51:23.676Z] Server: Azurite-Blob/3.14.1
[2022-03-04T16:51:23.677Z] Date: Fri, 04 Mar 2022 16:51:23 GMT
[2022-03-04T16:51:23.678Z] Connection: keep-alive
[2022-03-04T16:51:23.678Z] Keep-Alive: REDACTED
[2022-03-04T16:51:23.679Z] Content-Length: 0
[2022-03-04T16:51:23.679Z] .
[2022-03-04T16:51:51.585Z] There was an error performing …
Run Code Online (Sandbox Code Playgroud)

azure-functions azurite

2
推荐指数
1
解决办法
3167
查看次数

Azure 函数 Azurite 404 BlobNotFound

清理 Azurite 文件夹并重新启动我的 .Net 6 Azure Functions ~4 项目后,出现以下错误:

Azure.RequestFailedException: 'Service request failed.
Status: 404 (The specified container does not exist.)
ErrorCode: ContainerNotFound

Headers:
Server: Azurite-Blob/3.18.0
x-ms-error-code: ContainerNotFound
x-ms-request-id: 94748aff-d2c2-492f-af58-9876fbab8338
Date: Thu, 25 Aug 2022 08:03:14 GMT
Connection: keep-alive
Keep-Alive: REDACTED
'
Run Code Online (Sandbox Code Playgroud)

我的Local.settings.json配置设置为使用本地开发存储:

{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "UseDevelopmentStorage=true",
    "FUNCTIONS_WORKER_RUNTIME": "dotnet",
    "AzureWebJobsSecretStorageType": "files"
  }
}
Run Code Online (Sandbox Code Playgroud)

我的项目没有任何改变。这是来自 的内部错误BlobLeaseDistributionManager.cs

虽然它可以正确连接到我的本地 Azurite 安装,但它抱怨容器不存在。有没有办法创建这个容器或者可能有不同的解决方案?

azure-functions azurite .net-6.0

2
推荐指数
1
解决办法
3606
查看次数

蓝铜矿容器不暴露 ssl

我正在尝试使用这些说明来设置蓝铜矿,我看到其他一些人已经成功地做到了这一点。我需要为我的客户端应用程序测试配置 SSL(最终是 oauth)。蓝铜矿容器在没有 SSL 的情况下也可以正常工作,但是当激活 SSL 时,我的客户端无法连接,因为容器没有公开证书。

我使用 mkcert 来创建证书。这是我的 docker-compose 文件。我正在从我的主机安装 /certs 和 /data。

version: '3.9'

services:
  azurite:
    image: mcr.microsoft.com/azure-storage/azurite
    container_name: "azurite"
    hostname: azurite
    restart: always
    ports:
      - "10000:10000"
      - "10001:10001"
      - "10002:10002" 
    command: "azurite --oauth basic --cert /certs/127.0.0.1.pem --key /certs/127.0.0.1-key.pem --debug /logs/azurite-debug.log"      
    volumes:
        - ./azurite-store:/data
        - ./certs:/certs
        - ./azurite-logs:/logs
Run Code Online (Sandbox Code Playgroud)

在容器内使用 openssl 显示; 容器内的 openssl

这是我期望从 mkcert 获得的证书,它是根据撰写文件安装的。

在我的笔记本电脑上,openssl 显示以下内容; 在此输入图像描述 在此输入图像描述

乐趣就这样结束了!为什么证书在容器内部的 url 上可见,但从外部看不到?我在 compose 文件中看不到任何可以控制证书是否公开的内容 - 我有理由确定 docker 不会那样工作 - 它只是将 tcp/ip 层暴露给我的笔记本电脑。

如果我停止容器,则无法访问端口 10000,启动它并打开它,这样我不认为这是我错误连接到的另一个进程。另外,我获得连接这一事实意味着这不是连接问题。

任何人对此有任何想法 - 这很奇怪!“证书过滤”如果我可以称之为它肯定是一个新的!?

ssl docker azurite

2
推荐指数
1
解决办法
868
查看次数