我在网络核心中有一个Azure功能,并希望在HttpTrigger中绑定请求和我的模型。 This issue on github似乎已得到解决,但我无法让它发挥作用。
错误
Microsoft.Azure.WebJobs.Host:无法将参数'req'绑定到HttpRequestMessage类型。
代码:
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>