核心3.0更新后Azure功能停止工作 [英] Azure functions stopped working after Core 3.0 update
问题描述
代码在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()'.
推荐答案
Azure应用服务当前不可用的ASP.NET Core 3.0。 [Microsoft Docs]
ASP.NET Core 3.0 not currently available for Azure App Service. [Microsoft Docs]
我了解。NET Core 3.0的预览版 [Microsoft文档]可在Azure服务上获得。
I understand the preview versions of .NET Core 3.0 [Microsoft Docs] are available on the Azure service.
Azure Functions 3.0,它将完全兼容兼容Core 3.0的mpatible将于10月推出-请参见此公告
Azure Functions 3.0, which will be fully compatible with Core 3.0, will be available in October - see this announcement
这篇关于核心3.0更新后Azure功能停止工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!