简体   繁体   中英

WebJob throws FunctionIndexingException with multiple methods

These methods work individually, but do not work together.

public static class Functions
{
    public static void ProcessQueueMessage([QueueTrigger("queue1")] JobClass message,
        TextWriter log)
    {
    }

    public static void ProcessQueueMessage([QueueTrigger("queue2")] JobClass[] message,
        TextWriter log)
    {
    }
}

On run of the WebJob throws:

Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexingException occurred Message: Exception thrown: 'Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexingException' in Microsoft.Azure.WebJobs.Host.dll Additional information: Error indexing method 'ProcessQueueMessage'

The WebJob cannot setup multiple methods that share a name (overloads). Rename the methods so that they are not overloads:

public static class Functions
{
    public static void ProcessQueueMessage([QueueTrigger("queue1")] JobClass message,
        TextWriter log)
    {
    }

    public static void ProcessQueueMessages([QueueTrigger("queue2")] JobClass[] messages,
        TextWriter log)
    {
    }
}

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM