我已经下载了 VS2017 社区版来试用 Azure 功能,但我无法让它工作。我在 Stackoverflow 和 Azure 函数 Github 页面上搜索了许多帖子,但似乎没有关于任何内容的完整文档。
这是我所拥有的:
天青功能:
namespace FunctionApp1
{
public static class Function1
{
[FunctionName("Function1")]
public static void Run([ServiceBusTrigger("ngctestqueue", AccessRights.Manage, Connection = "Endpoint=sb://ngcservicebus.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=SERVICE_BUS_KEY")]string myQueueItem, TraceWriter log)
{
log.Info($"C# ServiceBus queue trigger function processed message: {myQueueItem}");
}
}
}
主机.json
{
"disabled": false,
"bindings": [
{
"name": "myQueueItem",
"type": "serviceBusTrigger",
"direction": "in",
"queueName": "ngctestqueue",
"connection": "connection",
"accessRights": "manage"
}
]
}
local.settings.json
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "DefaultEndpointsProtocol=https;AccountName=ngctest2;AccountKey=STORAGE_ACCOUNT_KEY;EndpointSuffix=core.windows.net",
"AzureWebJobsDashboard": "DefaultEndpointsProtocol=https;AccountName=ngctest2;AccountKey=STORAGE_ACCOUNT_KEY;EndpointSuffix=core.windows.net",
"AzureWebJobsServiceBus": "Endpoint=sb://ngcservicebus.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=SERVICE_BUS_KEY",
"connection": "Endpoint=sb://ngcservicebus.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=SERVICE_BUS_KEY"
}
}
当我在本地通过 F5 运行该函数时,出现以下错误:
Microsoft.Azure.WebJobs.Host: Error indexing method 'Func
tion1.Run'. Microsoft.Azure.WebJobs.ServiceBus: Microsoft Azure WebJobs SDK Serv
iceBus connection string 'AzureWebJobsEndpoint=sb://ngcservicebus.servicebus.win
dows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=SERVICE_BUS_KEY' is missing or empty.
我的开发环境如下:
1) 视窗 8.1 专业版
2) VS2017 社区 15.3.5
3) Azure 函数 CLI 1.0.4
任何帮助将不胜感激。
谢谢你。