问题
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