I created one console for sending message to Azure Service bus topic and created to one service bus topic trigger. In locally it's working fine, but the same code is not working after deploy the same function in azure. I am new for Azure, Please help to solve the issue and take my code details below.
host.json
{
"version": "2.0",
"aggregator": {
"batchSize": 1000,
"flushTimeout": "00:00:30"
},
"extensions": {
"cosmosDb": {},
"durableTask": {},
"eventHubs": {},
"http": {},
"queues": {},
"sendGrid": {},
"serviceBus": {}
},
"functions": [],
"functionTimeout": "00:05:00",
"healthMonitor": {
"enabled": true,
"healthCheckInterval": "00:00:10",
"healthCheckWindow": "00:02:00",
"healthCheckThreshold": 6,
"counterThreshold": 0.80
},
"logging": {
"fileLoggingMode": "debugOnly",
"logLevel": {
"Function.MyFunction": "Information",
"default": "None"
},
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"maxTelemetryItemsPerSecond": 5
}
}
},
"singleton": {
"lockPeriod": "00:00:15",
"listenerLockPeriod": "00:01:00",
"listenerLockRecoveryPollingInterval": "00:01:00",
"lockAcquisitionTimeout": "00:01:00",
"lockAcquisitionPollingInterval": "00:00:03"
},
"watchDirectories": [ "Shared", "Test" ]
}
local.setting.json
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "DefaultEndpointsProtocol=https;....",
"FUNCTIONS_WORKER_RUNTIME": "dotnet",
"MyConnection": "Endpoint=sb://...."
}
}
tried another one
{
"IsEncrypted": false,
"Values": {
"FUNCTIONS_WORKER_RUNTIME": "dotnet",
"MyConnection": "Endpoint=sb://",
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"AzureWebJobsDashboard": "UseDevelopmentStorage=true"
},
"Host": {
"LocalHttpPort": 7077
}
}
Function code:
[FunctionName("Function1")]
public static void Run([ServiceBusTrigger("*****", "*****", Connection = "MyConnection")]string mySbMsg, ILogger log)
{
log.LogInformation($"C# ServiceBus topic trigger function processed message: {mySbMsg}");
}
MyConnection--> Passing the service bus connection string here.
In local we can get the debug point, If we try with run the same function alone in another server it's not listening the request. Where I did the mistake? help me to solve this issue!
Update As well as, while publish the Azure bus click the application setting in visual studio. Then you need to give the connection string to remote also. Then surely it will work!