当前位置: 首页 > 知识库问答 >
问题:

存储帐户连接字符串无效

楚羽
2023-03-14

我使用ServiceBustigger创建了一个Azure Function应用程序(监听主题订阅)。很好。但是现在我试图制作一个QueueTrigger来监听一个简单的队列,但是我得到了以下错误。

我也是这样做的。我在Visual Studio中创建了一个新项目,并将其指向我在Azure上的存储帐户。指定了队列名称。队列存在。我尝试创建一个新的共享访问策略。已将连接字符串复制到本地。设置。json。

[2022-02-04T18:30:22.917Z] Found C:\Users\me\.NET\EmailUtilityLogger\EmailUtilityLogger\EmailUtilityLogger.csproj. Using for user secrets file configuration.
[2022-02-04T18:30:24.684Z] Microsoft.Azure.WebJobs.Host: Error indexing method 'Function1'. Microsoft.Azure.WebJobs.Extensions.Storage: Storage account connection string for 'AzureWebJobsAzureWebJobsServiceBus' is invalid.
[2022-02-04T18:30:24.703Z] Error indexing method 'Function1'
[2022-02-04T18:30:24.705Z] Microsoft.Azure.WebJobs.Host: Error indexing method 'Function1'. Microsoft.Azure.WebJobs.Extensions.Storage: Storage account connection string for 'AzureWebJobsAzureWebJobsServiceBus' is invalid.
[2022-02-04T18:30:24.706Z] Function 'Function1' failed indexing and will be disabled.
[2022-02-04T18:30:24.709Z] No job functions found. Try making your job classes and methods public. If you're using binding extensions (e.g. Azure Storage, ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. builder.AddAzureStorage(), builder.AddServiceBus(), builder.AddTimers(), etc.).
[2022-02-04T18:30:24.746Z] The 'Function1' function is in error: Microsoft.Azure.WebJobs.Host: Error indexing method 'Function1'. Microsoft.Azure.WebJobs.Extensions.Storage: Storage account connection string for 'AzureWebJobsAzureWebJobsServiceBus' is invalid.

我不确定我错过了什么......这主要是生成项目时的默认代码。不过,错误消息中有一件奇怪的事情是连接名称。它使用“AzureWebJobAzureWebJobServiceBus”,而我的连接名称是“AzureWebJobServiceBus”。

这是我的应用程序。

using System;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host;
using Microsoft.Extensions.Logging;

namespace EmailUtilityLogger
{
    public class Function1
    {
        [FunctionName("Function1")]
        public void Run([QueueTrigger("emailutilititylogger", Connection = "AzureWebJobsServiceBus")]string myQueueItem, ILogger log)
        {
            log.LogInformation($"C# Queue trigger function processed: {myQueueItem}");
        }
    }
}

还有当地人。设置。json文件。

{
    "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "DefaultEndpointsProtocol=https;AccountName=saneteaidemo;AccountKey=1234abcdsecretstuff==;....",
    "FUNCTIONS_WORKER_RUNTIME": "dotnet",
    "AzureWebJobsServiceBus": "Endpoint=sb://pspeaidemo.servicebus.windows.net/;SharedAccessKeyName=EmailLogger;SharedAccessKey=1234abcdsecretstuff="
  }
}

共有1个答案

夏骏
2023-03-14

您得到的错误显示了一个连接字符串名称(AzureWebJobAzureWebJobServiceBus),该名称与配置文件(AzureWebJobServiceBus)中找到的连接字符串名称不匹配。请验证local.settings.json是否与较新版本的文件一起复制,并且其内容是否与项目文件内容匹配。

 类似资料:
  • 我有一个函数应用,定义如下 其中< code > let-test-this-in 和< code > let-test-this-out 是连接字符串为< code >“defaultendpointsprocol=”的存储帐户下现有存储队列的名称...;account name =…;AccountKey= ... "(直接从门户中的访问键-连接字符串复制而来)。我发布时生成的function

  • 我在连接到ASP. NET MVC5中的Azure Blob存储帐户时遇到问题。 我看了一些教程,提出了一个带有BlobStorageContainerFactory的简单存储库模式,这样我就可以注入命名的存储库。当我使用Azure Storage local development emulator时,这段代码运行良好。以下是工厂代码: 我尝试解析连接字符串时出错: 堆栈跟踪:

  • 我尝试在我的函数应用程序的AzureWebJobsStorage应用程序设置中更新存储帐户连接字符串,但在更新后,所有函数都开始在响应中给出401 Unauthorized,即使函数应用程序的入站和出站IP地址已列入存储帐户的白名单中。 唯一有效的功能是具有授权级别的功能。代码中匿名。 我试着重启功能应用程序,并从azure pipelines中重新部署它,但似乎没有任何效果。我真的卡住了,不知道

  • 是否需要其他数据来生成ConnectionString?

  • 您好,我正在创建一个新的blob触发的azure函数,我想了解函数头中“Connection=”参数的作用: 我所做的是完全删除该参数,在我将其部署到我的azure订阅后,它就可以正常工作了。因此,我想知道如果我没有使用连接参数指定任何特定帐户,该函数如何确定要使用哪个存储帐户。 这就是我部署函数的方式:

  • 首先,我将引用另外两个对这个问题有部分答案的问题。 删除VM后从Azure中删除磁盘 如何删除Microsoft Azure存储中的租用blob 使用Azure Explorer,我可以删除blob和容器,但当我尝试删除存储帐户时,我出现了以下错误: 删除存储帐户“bitnamiWestusflwdmy”失败。无法删除存储帐户“bitnamiWestusflwdmy”:“存储帐户bitnamiWe