c# - azure 函数queueTrigger 错误 - Microsoft Azure WebJobs SDK '[Hidden Credential]' 连接字符串丢失或为空

标签 c# azure queue azure-web-app-service azure-functions

我已经为 QueueTrigger 创建了新的 Azure Function,但在本地运行后出现了下面一些奇怪的错误。

Function1.cs

public static class Function1
    {
        [FunctionName("Function1")]
        public static void Run([QueueTrigger("demoqueue", Connection = "DefaultEndpointsProtocol=myconnectionstring")]string myQueueItem, TraceWriter log)
        {
            log.Info($"C# Queue trigger function processed: {myQueueItem}");
        }
    }

本地.setting.json

{
    "IsEncrypted": false,
    "Values": {
        "AzureWebJobsStorage": "UseDevelopmentStorage=true",
        "AzureWebJobsDashboard": "UseDevelopmentStorage=true"
    }
}

错误 -

[11/14/2018 4:36:15 PM] The following 1 functions are in error: [11/14/2018 4:36:15 PM] Run: Microsoft.Azure.WebJobs.Host: Error indexing method 'Function1.Run'. Microsoft.Azure.WebJobs.Host: Microsoft Azure WebJobs SDK '[Hidden Credential]' connection string is missing or empty. The Microsoft Azure Storage account connection string can be set in the following ways: [11/14/2018 4:36:15 PM] 1. Set the connection string named '[Hidden Credential]' in the connectionStrings section of the .config file in the following format , or [11/14/2018 4:36:15 PM] 2. Set the environment variable named '[Hidden Credential]', or [11/14/2018 4:36:15 PM] 3. Set corresponding property of JobHostConfiguration.

最佳答案

您需要指定连接字符串存储在配置中的应用程序设置的键,而不是连接字符串本身。

public static void Run([QueueTrigger("demoqueue", Connection = "NameOfYourAppSetting")]

关于c# - azure 函数queueTrigger 错误 - Microsoft Azure WebJobs SDK '[Hidden Credential]' 连接字符串丢失或为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53304959/

相关文章:

c# - 公开引用的类型(类)而不需要额外的引用

c# - 如何实现TPL在1分钟延迟后运行进程?

c# - 将接口(interface)类型作为参数传递

javascript - 调试 MobileServiceClient 请求

azure - 从 azure devops 同步中排除 azure 数据工厂连接和集成运行时

queue - 使用队列时如何在 tensorflow 训练期间测试网络

python - 将队列转储到python中的列表/数组中

c++ - 通过值获取 std::queue 中元素的索引

c# - 我应该如何从 P&P 为 EventAggregator 创建事件,以便 UI 线程上的订阅者可以收听它们?

Azure Active Directory 对象权限