I'm in the middle of migrating from .NET Core 3.1 to .NET 5.0 for my Azure Functions project. I have the following function decleration:
using Microsoft.Azure.Functions.Worker;
using Microsoft.Azure.Functions.Worker.Http;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Http;
[Function("Test")]
public static async Task Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequestMessage req,
ILogger log,
Microsoft.Azure.WebJobs.ExecutionContext context)
{
...
}
However, I receive the following error message:
System.Private.CoreLib: Exception while executing function: Functions.SaveBlob. System.Private.CoreLib: Result: Failure
Exception: Microsoft.Azure.Functions.Worker.Diagnostics.Exceptions.FunctionInputConverterException: Error converting 1 input parameters for Function 'Test': Cannot convert input parameter 'req' to type 'System.Net.Http.HttpRequestMessage' from type 'Microsoft.Azure.Functions.Worker.GrpcHttpRequestData'.
I need to keep the ExecutionContext for my application.
How can I fix this error?