Azure Functions not working with Queue Trigger

2019-06-27 05:11发布

问题:

Thanks in advance to anyone that can help.

I'm creating the following function in Azure with a queue trigger.

[FunctionName("SubmitJob")]
public static async Task Run(
       [ServiceBusTrigger("jobs", Connection = "AzureStorage")]string queueItem,
       TraceWriter log,
       IBinder binder)
{
    // Code Here
}

As soon as try and debug in visual I get the error below and the host keeps restarting.

[09/07/2018 16:06:20] Host initialized (325ms)
[09/07/2018 16:06:20] Host lock lease acquired by instance ID '0000000000000000000000005CC4C4A2'.
[09/07/2018 16:06:20] A ScriptHost error has occurred
[09/07/2018 16:06:20] System.Private.Uri: Value cannot be null.
[09/07/2018 16:06:20] Parameter name: uriString.
[09/07/2018 16:06:20] Stopping Host

I am using Azure Functions 2. If I comment out the function in my solution the host starts ok, and it is now just an empty function to rule out anything else out.

Any ideas on where to look would be appreciated.

回答1:

Ok,

If anyone else come across this I used the template generator to add the function and this used the ServiceBusTrigger attribute. I guess this needs it's own configuration.

If you want to use your Azure Storage Queue use QueueTrigger Attribute instead.

Thanks again for anyone looking into this.