【发布时间】:2020-02-03 02:14:23
【问题描述】:
Azure Functions/EFSQLSERVER .NET CORE 3.0 的问题:
复制:
- 使用 Visual Studio 2019 16.2.1
- 使用 Azure Function 模板创建项目。
- 将目标框架更改为 .NET Core 3.0
- 添加 Microsoft.EntityFrameworkCore.SqlServer" 版本="3.0.0" 通过 Nuget 包管理器进行参考。
- 使用 F5 执行函数应用程序
导致错误,如以下 sn-ps 所示。有人遇到过这个问题吗?
Azure Functions Core Tools (2.7.1633 Commit hash: 45c7d86a3bbc9ed0a80a8f4199aa7ea80ccfb24e)
Function Runtime Version: 2.0.12673.0
[10/4/2019 6:13:14 PM] Building host: startup suppressed:False, configuration suppressed: False
[10/4/2019 6:13:14 PM] Loading startup extension 'Startup'
[10/4/2019 6:13:14 PM] Loaded extension 'Startup' (1.0.0.0)
[10/4/2019 6:13:14 PM] Loading startup extension 'DurableTask'
[10/4/2019 6:13:14 PM] Loaded extension 'DurableTask' (1.0.0.0)
[10/4/2019 6:13:14 PM] A host error has occurred
[10/4/2019 6:13:14 PM] FunctionApp5: Method not found: 'Microsoft.Extensions.DependencyInjection.IServiceCollection Microsoft.Azure.Functions.Extensions.DependencyInjection.IFunctionsHostBuilder.get_Services()'.
Value cannot be null.
Parameter name: provider
我的 nuget 包来自 csproj 文件。
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.0.0" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.DurableTask" Version="1.8.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.0.0" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.29" />
</ItemGroup>
using Microsoft.Azure.Functions.Extensions.DependencyInjection;
[assembly: FunctionsStartup(typeof(FunctionApp5.Startup))]
namespace FunctionApp5
{
public class Startup : FunctionsStartup
{
public override void Configure(IFunctionsHostBuilder builder)
{
**var x = builder.Services;**
}
}
}
【问题讨论】:
-
这一定是包问题,因为我有类似的问题。只需添加 http 扩展包 (Microsoft.Http.Extensions),我就会收到此错误(不使用该包中的任何代码)。通过删除它,错误消失了。我在 16.3.2 上使用相同的 webjobs 版本。
标签: azure .net-core-3.0 azure-functions-runtime entity-framework-core-3.0