我一直在尝试运行我的Linux Function应用程序,但我现在一直被这个错误卡住:
Microsoft.Azure.WebJobs.Script:在外部启动类中生成配置时出错。Microsoft.Azure.WebJobs.Extensions.FunctionMetadataLoader:未找到文件“/home/site/favicon. ico”。
我可以在/home/site/wwwroot/中看到我所有的项目dll和资产,但这个错误一直声称应该有一个文件夹或文件与我的项目名称在那里?
我的项目是使用dotnet 6隔离运行。
任何想法为什么这个FunctionMetadataLoader正在寻找这个文件/文件夹?我检查了我部署的类似Windows应用程序,它们都直接在wwwroot中有文件。
此应用程序在Linux操作系统中运行,I1层ASP。它在Azure DevOps Zip Deploy中从CICD发布。
这里是我的手臂模板的一部分功能应用程序。
"resources": [
{
"apiVersion": "2021-04-01",
"type": "Microsoft.Resources/deployments",
"name": "[concat(parameters('appServiceName'), '-deployment','-', uniqueString(guid('any')))]",
"dependsOn": [],
"resourceGroup": "[parameters('appServiceResourceGroup')]",
"properties": {
"mode": "Incremental",
"template": {
"$schema": "http://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"variables": {},
"resources": [
{
"apiVersion": "2018-11-01",
"name": "[parameters('appServiceName')]",
"type": "Microsoft.Web/sites",
"location": "[parameters('location')]",
"kind": "functionapp,linux",
"tags": {
"environment": "[parameters('environmentTag')]",
"monitor": "[parameters('monitorTag')]",
"owner": "[parameters('ownerTag')]",
"workload": "[parameters('workloadTag')]",
"serviceLine": "[parameters('serviceLineTag')]",
"system": "[parameters('systemTag')]",
"initiatingEpic": "[parameters('initiatingEpicTag')]",
"dr": "[parameters('drTag')]",
"notes": "[parameters('notesTag')]"
},
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"[resourceId(parameters('appServiceResourceGroup'),'Microsoft.ManagedIdentity/userAssignedIdentities/',parameters('managedIdentityName'))]": {}
}
},
"properties": {
"name": "[parameters('appServiceName')]",
"httpsOnly": true,
"reserved": true,
"isXenon": false,
"hyperV": false,
"siteConfig": {
"use32BitWorkerProcess": false,
"minTlsVersion": "1.2",
"ftpsState": "Disabled",
"http20Enabled": true,
"netFrameworkVersion": "v6.0",
"linuxFxVersion": "DOTNET-ISOLATED|6.0",
"appSettings": [
{
"name": "APPINSIGHTS_INSTRUMENTATIONKEY",
"value": "[reference(variables('appInsightsResourceId'), variables('appInsightsApiVersion'), '2016-03-01').instrumentationKey]"
},
{
"name": "APPLICATIONINSIGHTS_CONNECTION_STRING",
"value": "[reference(variables('appInsightsResourceId'), variables('appInsightsApiVersion'), '2016-03-01').ConnectionString]"
},
{
"name": "ApplicationInsightsAgent_EXTENSION_VERSION",
"value": "~2"
},
{
"name": "FUNCTIONS_EXTENSION_VERSION",
"value": "~4"
},
{
"name": "FUNCTIONS_WORKER_RUNTIME",
"value": "dotnet-isolated"
},
{
"name": "AzureWebJobsStorage",
"value": "[parameters('storageAccountConnection')]"
},
{
"name": "AzureFunctionsWebHost__hostId",
"slotSetting": false,
"value": ""
},
{
"name": "WEBSITE_RUN_FROM_PACKAGE",
"slotSetting": false,
"value": "0"
}
],
"connectionStrings": [],
"alwaysOn": true
},
"keyVaultReferenceIdentity": "[resourceId(parameters('appServiceResourceGroup'),'Microsoft.ManagedIdentity/userAssignedIdentities/',parameters('managedIdentityName'))]",
"clientAffinityEnabled": false,
"serverFarmId": "[resourceId(parameters('serverFarmResourceGroup'),'Microsoft.Web/serverFarms',parameters('appServicePlanName'))]",
"hostingEnvironment": "[parameters('appServiceEnvironmentName')]"
}
}
]
}
}
}
]
项目文件:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
<OutputType>Exe</OutputType>
<_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>
<PublishReadyToRun>true</PublishReadyToRun>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.10.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Warmup" Version="4.0.2" />
<PackageReference Include="Microsoft.ApplicationInsights.WorkerService" Version="2.21.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.ServiceBus" Version="5.7.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.7.0" OutputItemType="Analyzer">
<TreatAsUsed>true</TreatAsUsed>
</PackageReference>
<PackageReference Include="Microsoft.FeatureManagement.AspNetCore" Version="2.5.1" />
<PackageReference Include="Serilog.AspNetCore" Version="6.1.0" />
</ItemGroup>
<ItemGroup>
</ItemGroup>
<ItemGroup>
<None Update="host.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="local.settings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</None>
</ItemGroup>
</Project>
2条答案
按热度按时间rkkpypqq1#
我尝试在Azure DevOps中通过ARM模板使用Function App部署**
.Net 6.0 Isolated Function
**,并成功运行,参考如下:-functionapp.json
你可以试试这个ARM模板进行测试。
下面的ARM模板参考来自我的SO线程答案请参考我的答案,以了解如何使用ARM模板部署Function应用程序和触发器。
我的Azure Devops存储库:-
我的构建yaml管道:-
输出:-
请确保在CORS设置中添加此**
https://portal.azure.com
**,如下所示:带有.net 6.0隔离函数的函数应用程序已部署并成功运行,请参阅以下内容:-
使用ARM模板部署的发布管道的相同部署:资源组范围任务:-
输出:-
rsl1atfo2#
win-x64必须是linux-x64,如果你运行的是Linux Function应用程序