Core 3.0 更新后 Azure 功能停止工作 [英] Azure functions stopped working after Core 3.0 update

查看:26
本文介绍了Core 3.0 更新后 Azure 功能停止工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

代码在 Core 3.0 preview7 版本中运行,但更新到 3.0 后 Azure 函数开始报错.

The code is working in Core 3.0 preview7 version, but after updating to 3.0 Azure functions started giving an error.

如果我尝试访问构建器服务对象,则会出现错误.也无法调试问题.还尝试更新 Microsoft.Extensions.DependencyInjection 3.0 但仍然是同样的错误.

The error comes if I try to access builder service object. Also not able to debug the issue. Also tried updating Microsoft.Extensions.DependencyInjection 3.0 but still the same error.

public class Startup : FunctionsStartup
{
    public override void Configure(IFunctionsHostBuilder builder)
    {
    var descriptor = builder.Services.FirstOrDefault(d => d.ServiceType == typeof(IConfiguration)); // error after adding this
        var currentDirectory = $"{Environment.GetEnvironmentVariable("HOME")}\site\wwwroot";


        var configurationBuilder = new ConfigurationBuilder();

        var configuration = configurationBuilder.SetBasePath(currentDirectory)
            .AddJsonFile("local.settings.json", optional: true, reloadOnChange: true)
            .AddEnvironmentVariables()
                    .Build();
}
}

执行时出现以下错误:找不到方法:Microsoft.Extensions.DependencyInjection.IServiceCollection Microsoft.Azure.Functions.Extensions.DependencyInjection.IFunctionsHostBuilder.get_Services()".

When executing the below error comes: Method not found: 'Microsoft.Extensions.DependencyInjection.IServiceCollection Microsoft.Azure.Functions.Extensions.DependencyInjection.IFunctionsHostBuilder.get_Services()'.

推荐答案

ASP.NET Core 3.0 目前不适用于 Azure 应用服务. [微软文档]

我了解 .NET Core 3.0 的预览版 [Microsoft Docs] 在 Azure 服务上可用.

I understand the preview versions of .NET Core 3.0 [Microsoft Docs] are available on the Azure service.

将与 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 - see this announcement

这篇关于Core 3.0 更新后 Azure 功能停止工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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