Azure functions stopped working after Core 3.0 update

≡放荡痞女 提交于 2020-01-11 07:30:08

问题


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

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();
}
}

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


回答1:


ASP.NET Core 3.0 not currently available for Azure App Service. [Microsoft Docs]

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

Azure Functions 3.0, which will be fully compatible with Core 3.0, will be available in October - see this announcement



来源:https://stackoverflow.com/questions/58133089/azure-functions-stopped-working-after-core-3-0-update

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!