0
votes

I was using .net core Azure function in an app, with no problem faced, with the below code.

But when I create an Azure function app using .net framework it is throwing below error.

I tried all possible google solutions. the error is clearly because of nuget and library as same code works fine for v2 .net core function app.

[FunctionName("Function1")]
        public static async System.Threading.Tasks.Task RunAsync([ServiceBusTrigger("topic", "sub", Connection = "ConnectionStringSettingName")]Message mySbMsg, string lockToken, MessageReceiver messageReceiver, ILogger log)
        {
            log.LogInformation($"C# ServiceBus topic trigger function processed message: {mySbMsg}");

            
        }

I even tried this as well:

 [FunctionName("Function1")]
            public static async System.Threading.Tasks.Task RunAsync([ServiceBusTrigger("topic", "sub", Connection = "ConnectionStringSettingName")]Message mySbMsg, Guid lockToken, MessageReceiver messageReceiver, ILogger log)
            {
                log.LogInformation($"C# ServiceBus topic trigger function processed message: {mySbMsg}");
    
                
            }

If I took it as guid or string or vice versa, it gives the error:

Error indexing method 'Function1.RunAsync'. Microsoft.Azure.WebJobs.Host: Cannot bind parameter 'lockToken' to type Guid. Make sure the parameter Type is supported by the binding. If you're using binding extensions (e.g. ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. config.UseServiceBus(), config.UseTimers(), etc.).

Vice versa error:

RunAsync: Microsoft.Azure.WebJobs.Host: Error indexing method 'Function1.RunAsync'. Microsoft.Azure.WebJobs.Host: Cannot bind parameter 'lockToken' to type Guid. Make sure the parameter Type is supported by the binding. If you're using binding extensions (e.g. ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. config.UseServiceBus(), config.UseTimers(), etc.).

1
what is the errorSajeetharan
updated the questionNeo

1 Answers

0
votes

The locktoken parameter that you are sending in is a string.

The error message is that it cannot bind the locktoken to a Guid.

Therefore, it is probably expecting a string that is a valid Guid, and you are sending in something else.