Azure Function App VS 2019 .NET 3.0中的错误-找不到方法:'IFunctionsHostBuilder.get_Services()' [英] Error in Azure Function App VS 2019 .NET 3.0 - Method not found: 'IFunctionsHostBuilder.get_Services()'

查看:70
本文介绍了Azure Function App VS 2019 .NET 3.0中的错误-找不到方法:'IFunctionsHostBuilder.get_Services()'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Azure Functions/EFSQLSERVER .NET CORE 3.0的问题:

Issue with Azure Functions/EFSQLSERVER .NET CORE 3.0:

要复制:

  • 使用Visual Studio 2019 16.2.1
  • 使用Azure Function模板创建项目.
  • 将目标框架更改为.NET Core 3.0
  • 添加Microsoft.EntityFrameworkCore.SqlServer"Version =" 3.0.0通过Nuget软件包管理器进行引用.
  • 使用F5的Excecut Function App

导致错误,如以下代码片段所示.有人遇到过这个问题吗?

Results in an error as showing in the following snippets. Anyone came across this issue?

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

我的csproj文件中的nuget包.

My nuget packages from csproj file.

<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;**

        }
    }
}

推荐答案

目前,ASP.NET Core 3.0当前不适用于Azure App Service,请选中此 Microsoft文档.

For now,ASP.NET Core 3.0 not currently available for Azure App Service, check this Microsoft doc.

与Core 3.0完全兼容的Azure Functions 3.0将于10月发布,请检查

Azure Functions 3.0, which will be fully compatible with Core 3.0, will be available in October, check here. However it's not released now.

从此问题中,您可以找到Azure函数现在的2.0版本不能与任何Microsoft.Extensions.* 3. *软件包一起使用,并且不能与.Net Core 3.0服务共享代码.

From this issue, you could find Azure Function 2.0 right now does not work with any Microsoft.Extensions.* 3.* packages and cannot share code with .Net Core 3.0 services.

有关Azure Fuction 3.0的更多信息,请检查讨论.

Further more information about Azure Fuction 3.0 check this discussion.

这篇关于Azure Function App VS 2019 .NET 3.0中的错误-找不到方法:'IFunctionsHostBuilder.get_Services()'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆