我遇到了很多麻烦System.Net.Http
使用 Azure Functions 时的库。如果我在门户中创建一个全新的 httptrigger 函数,它就可以正常工作。不过,我想用我自己的预编译汇编 https://github.com/Azure/azure-webjobs-sdk-script/wiki/Precompiled-functions。当我这样做时,我会遇到各种各样的问题。
我看到的一个症状是HttpRequestMessage
传入的内容没有详细信息。 RequestUri 为空,加上任何其他属性 - 例如。标头等。请注意,该参数不为空 - 它似乎没有填充任何内容。
另一个症状是当它尝试调用时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>
The Microsoft.AspNet.WebApi.Core
nuget 包包含system.net.http
图书馆。我尝试过与此相关的不同 nuget 包的各种组合 - 但没有运气。
有谁知道我应该使用哪些软件包才能使其正常工作?
我在 System.Net.Http 中遇到了 MissingMethodException 问题。对我有用的是以下参考:
<package id="System.Net.Http" version="4.0.0" targetFramework="net461" />
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)