- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我需要一些帮助来确定为什么部署到 Linux 消费计划的 Azure Functions 无法启动并提示 AspNetCore.App 运行时不可用:
我不太明白的是为什么这会引用 RC2。我们已将问题隔离到包依赖项 (StackExchange.Redis.Extensions.AspNetCore"Version="7.2.1"
) - 如果我们包含它,它会破坏 Azure 中部署的功能。
查看该依赖项的来源,似乎他们所做的只是引用 AspNetCore.App 框架引用,如下所示:
请注意,我们的 Azure Functions 能够使用相同的项目引用(相同库的 6.x 版本)运行 .Net 5 而不会出现任何问题。
我们正在使用 CLI 来创建和部署函数,如下所示:
构建:
- task: UseDotNet@2
inputs:
version: $(dotNetVersion)
displayName: Set DotNet Version $(dotNetVersion)
- task: DotNetCoreCLI@2
inputs:
command: 'build'
projects: '**/xyz.Function.OurFunction.csproj'
arguments: '--configuration $(buildConfiguration) --output $(System.DefaultWorkingDirectory)/func_api'
displayName: 'Build Function'
函数应用创建:
az functionapp create --name $(functionAppName)
--resource-group $(rg) --consumption-plan-location $(region)
--functions-version 4 --os-type Linux --runtime dotnet-isolated
--storage-account $(funstorageAccountName) --assign-identity '[system]'
部署:
- task: AzureFunctionApp@1
inputs:
azureSubscription: '$(azureSubscription)'
appType: 'functionAppLinux'
appName: '$(functionAppName)'
package: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
deploymentMethod: 'zipDeploy'
runtimeStack: 'DOTNET-ISOLATED|6.0'
appSettings: >-
-FUNCTIONS_WORKER_RUNTIME dotnet-isolated
最佳答案
以下是我在特定案例中如何解决这个史诗般的问题。
在 .csproj 属性中有 <TargetFramework>net5.0</TargetFramework>
和 <AzureFunctionsVersion>v3</AzureFunctionsVersion>
.
构建管道使用 Pool: Azure Pipelines
和 Image: ubuntu-latest
.
我遇到的第一个问题是 Azure Function App Deploy 发布管道任务试图部署 ZIP 工件。即使这是 Microsoft 的建议,这也会无限期挂起。因此之前有一个Extract files任务,解压$(System.DefaultWorkingDirectory)/func/drop/Functions.zip
至 $(Agent.TempDirectory)/func
. func
在我的案例中是工件源别名。
恕我直言,Azure Function App Deploy
任务已过时。
默认情况下,您可能选择的最新运行时堆栈是 DOTNET|3.1 (functionapp v3)
.
然后,在任务日志中,有人注意到:
Trying to update App Service Application settings.
Data:{"FUNCTIONS_WORKER_RUNTIME":"dotnet","WEBSITES_ENABLE_APP_SERVICE_STORAGE":"true"}
.
这是非常出乎意料的,因为我们使用的是进程外模型。
此外,启动命令为空。
试过 func azure functionapp publish $(functions-app-name) --no-bundler
和 dotnet functions.dll
无济于事。
msdocs 链接如下:
运行的功能和行为差异 on out-of-process compared to .NET class library functions running in-process
.NET 独立项目 guide
说明书 version updates on Linux
因此,在部署之后,有一个 Azure App Service Settings 任务设置 "FUNCTIONS_WORKER_RUNTIME":"dotnet-isolated"
.
那么救星就是this guide .
[!NOTE] To be able to publish your isolated function project to either a Windows or a Linux function app in Azure, you must set a value of dotnet-isolated in the remote FUNCTIONS_WORKER_RUNTIME application setting. To support zip deployment and running from the deployment package on Linux, you also need to update the linuxFxVersion site config setting to DOTNET-ISOLATED|6.0.
报告部署成功,函数应用程序显示 Function host is not running.
当我运行 az functionapp config show --name $(functions-app) --resource-group $(rg) --query 'linuxFxVersion' -o tsv
我得到了 DOTNET|3.1。
我也是 az functionapp config set --name $(functions-app) --resource-group $(rg) --linux-fx-version 'DOTNET-ISOLATED|5.0'
因为我的目标是 netcore5。这修复了所有问题,并在发布管道中部署后成为 Azure CLI 任务。
关于azure-functions - Dotnet Isolated Azure Function w/.Net 6 在 Linux 消费计划上提示 6.0 AspNetCore.App Runtime 不可用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70466876/
我有 ASP.NET Core Web 应用程序,我在其中使用 swagger 使用以下内容: public void ConfigureServices(IServiceCollection ser
AspNetCore.Mvc 和 AspNetCore.Mvc.Core NuGet 包之间有什么区别? Mvc.Core 只是简单的东西,而 Mvc 是一个包罗万象的包吗?这就是我从描述中猜测的he
我有一个包含多个项目的解决方案。我想创建一个项目的Docker镜像,因此我已经通过Docker支持添加了一个Dockerfile。我添加了Dockerfile的项目已在同一级别上依赖于其他项目。当我尝
我正在尝试使用 Ajax 将类列表返回到我的 View 这是我的ajax $(document).ready(function () { debugger; $.
我已经使用过几次这个包Microsoft.AspNetCore.TestHost在我的集成测试中托管 Asp.Net Core Web API 应用程序。 使用 Asp.Net Core 2.1 包
我正在尝试使用 Ajax 将类列表返回到我的 View 这是我的ajax $(document).ready(function () { debugger; $.
SignalR 客户端有两个 nuget 包: Microsoft.AspNetCore.SignalR.Client和 Microsoft.AspNetCore.SignalR.Client.Cor
这个错误的可能原因是什么: InvalidOperationException: No service for type 'Microsoft.AspNetCore.Identity.UserMana
使用 IFormFile 时,我在运行时收到此错误: Could not load type 'Microsoft.AspNetCore.Http.Internal.FormFile' from as
我正在尝试将我的 API 项目从 .net core 2.2 升级到 .net core 3.1。我在尝试进行 API 调用时遇到此异常。 "Message":"Could not load type
我在 netcoreapp3.0 Web 应用程序中使用 netstandard2.1 库。在 Startup 中添加我的服务时,出现以下错误: 'Could not load type 'Micro
我遇到以下异常: Cannot resolve parameter 'Microsoft.Extensions.Logging.ILogger logger' "At the moment (9/28
我们有使用 Swagger 的 .net core 2.1 mvc webapi 项目。 我们使用以下软件包: swashbuckle 的配置方式如下: services.AddMvcCo
我正在使用图书馆 "FluentValidation.AspNetCore": "6.4.0-beta3"在 .netcore WebApi在一个项目中。您可以在下面看到项目结构。如果我放置 Curr
怎么改Content root path在应用程序 .Net Core 3.0 ASP Blazor 上启动? 现在应用程序以输出开始 info: Microsoft.AspNetCore.DataP
我正在将 Microsoft.AspNetCore.Identity 添加到一个项目中,我得到了 InvalidOperationException: Unable to resolve servic
我有一个 Asp.Net Core 2 Mvc 项目。我目前正在尝试将数据访问分离到一个单独的项目中;但是,一旦我添加对数据访问库的引用,我就会遇到版本冲突: error NU1107: Versio
我理解的三大人生: 单例 有范围 短暂的 但我似乎找不到说明默认生命周期是多少(如果未明确定义)的文档。 最佳答案 默认情况下,注册类型的生命周期是 transient 的,即每次注入(inject)
我有一个正在泄漏线程的 ASP.NET Core 2 应用程序。我如何确定线程永不消亡的原因? 如果我在生产环境中运行该应用程序 10 分钟,IIS 开始吐出 502.3 Bad Gateway 错误
当尝试从新的DotNetCore类库导入AspNetCore MVC站点(WebApplication1)以便运行某些测试时,出现以下错误。 任何人都可以对编译器的工作原理以及为什么使用runtime
我是一名优秀的程序员,十分优秀!