0
votes

I have an Azure Function in net core and would like to bind both the request and my model in the HttpTrigger. This issue on github seems to be resolved but I can't get it to work.

Error

Microsoft.Azure.WebJobs.Host: Cannot bind parameter 'req' to type HttpRequestMessage.

Code:

public static class TestHttp{
    [FunctionName("TestHttp")]       
    public static async Task<IActionResult> Run([HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = null)]POCO data, HttpRequestMessage req){
        return new OkResult();
    }
}

csproj:

<Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
    <AzureFunctionsVersion>v2</AzureFunctionsVersion>
  </PropertyGroup>
  <ItemGroup> 
    <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.13" />
  </ItemGroup>
  <ItemGroup>
    <None Update="host.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <None Update="local.settings.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <CopyToPublishDirectory>Never</CopyToPublishDirectory>
    </None>
  </ItemGroup>
</Project>
1

1 Answers

0
votes

The issue you linked to likely only fixed this issue for Functions V1, and it looks like you are seeing this issue on Functions V2. I would reopen this issue and post your information there so that this issue can be fixed for V2 as well.