Azure 函数 - System.Net.Http
Azure Functions - System.Net.Http
我在使用 Azure Functions 时遇到了 System.Net.Http
库的很多问题。如果我在门户中创建一个全新的 httptrigger 函数,它可以正常工作。但是,我想使用我自己的precompiled assembly。当我这样做时,我遇到了各种各样的问题。
我看到的一个症状是传入的 HttpRequestMessage
中没有任何详细信息。 RequestUri 为空,加上任何其他属性 - 例如。 headers,等等。请注意参数不为空 - 它似乎没有填充任何内容。
另一个症状是,当它尝试调用 GetQueryNameValuePairs
时,它失败了:
Exception while executing function: Functions.WebHookSync. mscorlib: Exception has been thrown by the target of an invocation. MyFunctionName.Functions: Method not found: 'System.Collections.Generic.IEnumerable`1<System.Collections.Generic.KeyValuePair`2<System.String,System.String>> System.Net.Http.HttpRequestMessageExtensions.GetQueryNameValuePairs(System.Net.Http.HttpRequestMessage)'.
以下是我的 .csproj 文件的内容:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net46</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNet.WebApi.Core" Version="5.2.3" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions" Version="2.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MyOtherAssembly\MyOtherAssembly.csproj" />
</ItemGroup>
</Project>
Microsoft.AspNet.WebApi.Core
nuget 包包含 system.net.http
库。我已经尝试了与此相关的不同 nuget 包的各种组合 - 但没有运气。
有谁知道我应该使用什么包来让它工作?
这是函数运行时中的System.Net.Http
references。
我建议你添加尝试将它们直接添加到你的预编译项目中。
我在 System.Net.Http 中遇到 MissingMethodExceptions 问题。对我有用的是以下参考:
<package id="System.Net.Http" version="4.0.0" targetFramework="net461" />
我在使用 Azure Functions 时遇到了 System.Net.Http
库的很多问题。如果我在门户中创建一个全新的 httptrigger 函数,它可以正常工作。但是,我想使用我自己的precompiled assembly。当我这样做时,我遇到了各种各样的问题。
我看到的一个症状是传入的 HttpRequestMessage
中没有任何详细信息。 RequestUri 为空,加上任何其他属性 - 例如。 headers,等等。请注意参数不为空 - 它似乎没有填充任何内容。
另一个症状是,当它尝试调用 GetQueryNameValuePairs
时,它失败了:
Exception while executing function: Functions.WebHookSync. mscorlib: Exception has been thrown by the target of an invocation. MyFunctionName.Functions: Method not found: 'System.Collections.Generic.IEnumerable`1<System.Collections.Generic.KeyValuePair`2<System.String,System.String>> System.Net.Http.HttpRequestMessageExtensions.GetQueryNameValuePairs(System.Net.Http.HttpRequestMessage)'.
以下是我的 .csproj 文件的内容:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net46</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNet.WebApi.Core" Version="5.2.3" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions" Version="2.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MyOtherAssembly\MyOtherAssembly.csproj" />
</ItemGroup>
</Project>
Microsoft.AspNet.WebApi.Core
nuget 包包含 system.net.http
库。我已经尝试了与此相关的不同 nuget 包的各种组合 - 但没有运气。
有谁知道我应该使用什么包来让它工作?
这是函数运行时中的System.Net.Http
references。
我建议你添加尝试将它们直接添加到你的预编译项目中。
我在 System.Net.Http 中遇到 MissingMethodExceptions 问题。对我有用的是以下参考:
<package id="System.Net.Http" version="4.0.0" targetFramework="net461" />