1

Hello I have created a function in Azure Portal and seeing the queue data dequeued.

I have installed an CLI on my computer which when I run the project it will show a func.exe command prompt. I have added the connection string like this, inside the local.settings.json:

>  "Values": {
    "AzureWebJobsStorage": "DefaultEndpointsProtocol=https;AccountName=...",
    "AzureWebJobsDashboard": "DefaultEndpointsProtocol=https;AccountName=...",
    "tuxdev_STORAGE": "DefaultEndpointsProtocol=https;AccountName=..."
  } 

When I add a message to the queue in a portal, the application didn't receive the message. What other setting do I need to update.

enter image description here

Jerry Liu
  • 17,282
  • 4
  • 40
  • 61
LittleFunny
  • 8,155
  • 15
  • 87
  • 198

1 Answers1

3

According to your error message, it seems that the issue is your class or method not public. If I set my method to be private, I also get the same error as you.

enter image description here

If I set the function method to be public, everything works fine. The function would show the queue I have added in portal.

using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host;

 public static class Function1
{
    [FunctionName("Function1")]
    public static void Run([QueueTrigger("myqueue", Connection = "AzureWebJobsStorage")]string myQueueItem, TraceWriter log)
    {

        log.Info($"C# Queue trigger function processed: {myQueueItem}");
    }
}

enter image description here

Or the issue may be related with your nuget package versions. you could upgrade to the latest Microsoft.NET.Sdk.Functions (1.0.6 as of today) and Microsoft.Azure.WebJobs.Service.Bus (2.1.0-beta4 if running on full framework). Please refer to this article.

You should upgrade to the latest Microsoft.NET.Sdk.Functions (1.0.6 as of today) and Microsoft.Azure.WebJobs.Service.Bus (2.1.0-beta4 if running on full framework). You might need to remove ServiceBus reference first in order to upgrade SDK.

The Microsoft.Azure.Eventhubs package also needs to be removed. All relevant types etc are in Microsoft.Azure.WebJobs.Service.Bus

Also remember to check "Include prerelease" in the package manager in order to find 2.1.0-beta4

Community
  • 1
  • 1
Janley Zhang
  • 1,567
  • 7
  • 11
  • I think it may because I need to re update the visual studio. – LittleFunny Mar 13 '18 at 02:21
  • I tried to use it on a colleagues computer with the same code but it work on their computer. Only different are the environment. Have to try it first. – LittleFunny Mar 13 '18 at 02:34
  • This is my nuget packages(https://image.ibb.co/fBmLq7/nugetpackage.png). If it doesn't work, you could then try to update your vs. – Janley Zhang Mar 13 '18 at 02:37
  • @LittleFunny If you have changed code in Azure function, please make sure you have rebuild your project. Some times the new change would not work if you haven't rebuild your project. Right click project>click rebuild button to rebuild. – Janley Zhang Mar 13 '18 at 02:51
  • I will have a look. I am very appreciated of your help. Thanks – LittleFunny Mar 13 '18 at 02:52