I tried to create a Azure IotHubTrigger function (C#) that gets triggered when a new message arrives in the IotHub. My problem is that the function works locally to receive messages but when it is deployed the function gets never triggered. The app settings are also set in the Portal. Is it possible that I am missing some configuration to make it work in the cloud? I also tried to delete the function and recreate it and to use typescript instead of C# but nothing worked.
Below is the code of the function:
[FunctionName("IoTHubTest")]
public void Run([IoTHubTrigger("IotHubName", Connection = "IotHubConnectionString")]EventData message, ILogger log)
{
log.LogInformation($"C# IoT Hub trigger function processed a message: {Encoding.UTF8.GetString(message.Body.Array)}");
}
local.settings.json
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "DefaultEndpointsProtocol=https;AccountName=... ",
"FUNCTIONS_WORKER_RUNTIME": "dotnet",
"IotHubConnectionString": "Endpoint=sb:...",
"IotHubName": "iothub-..."
}
}
As per your information there is something which is missing during the deployment from local. Because it is working from local and also working when it is created from portal.
Follow the below steps to check the issue.
With this we can find the root cause.
Also along with this, there are two reason for the function app not triggering after deployment.
Apart from all these troubleshooting steps you share the information to Azure community. Check this GIT Azure function QnA
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.