我已经为 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/