我在尝试在Visual Studio中创建Servicebus Azure功能时遇到问题。当我在VS2017中执行该功能时,它工作得很好,但是当我发布消息时,我得到了异常:
函数($ ServiceBus)错误:函数'ServiceBus'的监听器 无法开始。 Microsoft.ServiceBus:40400:找不到端点。, 资源:SB://systemmonitordan.servicebus.windows.net/testtopic/subscriptions/catchall。 TrackingId:b1a96c67-032c-4c90-BD10-dbac92d11956_G7, SystemTracker:systemmonitordan.servicebus.windows.net:testtopic /订阅/全部接收
这是函数
using System;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host;
using Microsoft.ServiceBus.Messaging;
using StackExchange.Redis;
namespace Dan.DataUpdate.ServiceBus
{
public static class ServiceBus
{
private static readonly Lazy<ConnectionMultiplexer> lazyConnection;
static ServiceBus()
{
lazyConnection = new Lazy<ConnectionMultiplexer>(() => ConnectionMultiplexer.Connect(System.Environment.GetEnvironmentVariable("redisconectionstring")));
}
[FunctionName("ServiceBus")]
public static void Run([ServiceBusTrigger("testtopic", "CatchAll", AccessRights.Listen, Connection = "ServiceConnections")]string myQueueItem, TraceWriter log)
{
log.Info($"C# ServiceBus queue trigger function processed message: {myQueueItem}");
}
}
}
这是我的local.settings.json设置
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage":"DefaultEndpointsProtocol=https;AccountName=dansystemmonito80dc;AccountKey=accountkeystring;EndpointSuffix=core.windows.net",
"AzureWebJobsDashboard": "",
"ServiceConnections": "Endpoint=sb://systemmonitortest.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=sharedaccesskeystring",
"topicName": "testtopic",
"subscriptionName": "CatchAll"
}
}
这里是function.Json设置
{
"generatedBy": "Microsoft.NET.Sdk.Functions.Generator-1.0.6",
"configurationSource": "attributes",
"bindings": [
{
"type": "serviceBusTrigger",
"connection": "ServiceConnections",
"topicName": "testtopic",
"subscriptionName": "CatchAll",
"accessRights": "listen",
"name": "myQueueItem"
}
],
"disabled": false,
"scriptFile": "../bin/Dan.DataUpdate.ServiceBus.dll",
"entryPoint": "Dan.DataUpdate.ServiceBus.ServiceBus.Run"
}
以下是我的功能应用程序设置
AzureWebJobsDashboard DefaultEndpointsProtocol=https;AccountName=danmonitorfunct895c;AccountKey=accountkey
AzureWebJobsStorage DefaultEndpointsProtocol=https;AccountName=danmonitorfunct895c;AccountKey=accountkey
topicName : testtopic
subscriptionName : CatchAll
ServiceConnections:
Endpoint=sb://systemmonitordan.servicebus.windows.net/
;SharedAccessKeyName=RootManageSharedAccessKey;
SharedAccessKey=sharedAccessKey
有什么东西我不见了吗?