gpt4 book ai didi

azure - 用于创建 NET 5 应用服务的 ARM 模板

转载 作者:行者123 更新时间:2023-12-02 19:06:43 24 4
gpt4 key购买 nike

我有一个创建 Azure 应用程序服务的 ARM 模板,它对于 .NET Core 运行良好,但我现在想更新该模板以部署 NET 5 应用程序服务,我没有任何运气。这是 ARM 架构:https://learn.microsoft.com/en-us/azure/templates/microsoft.web/sites

这是模板的摘录,我运行了它,但是当我查看门户时,该网站是使用 .NET Framework 版本的 ASPNET 4.8 创建的。如何使用 ARM 模板部署 NET 5 站点?

    {
"name": "[variables('apiAppServiceName')]",
"type": "Microsoft.Web/sites",
"apiVersion": "2020-06-01",
"location": "[parameters('location')]",
"dependsOn": [
"[variables('hostingPlanName')]",
"[variables('databaseName')]",
"[variables('storageAccountName')]"
],
"tags": {
"[concat('hidden-related:', resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName')))]": "empty",
"displayName": "Website",
"environment": "[parameters('environment')]"
},
"properties": {
"name": "[variables('apiAppServiceName')]",
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName'))]",
"httpsOnly": true,
"clientAffinityEnabled": false,
"netFrameworkVersion": "net5.0"
},

最佳答案

查看 Azure 生成的模板:

{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"subscriptionId": {
"type": "string"
},
"name": {
"type": "string"
},
"location": {
"type": "string"
},
"hostingPlanName": {
"type": "string"
},
"serverFarmResourceGroup": {
"type": "string"
},
"alwaysOn": {
"type": "bool"
},
"currentStack": {
"type": "string"
},
"phpVersion": {
"type": "string"
},
"netFrameworkVersion": {
"type": "string"
}
},
"resources": [
{
"apiVersion": "2018-11-01",
"name": "[parameters('name')]",
"type": "Microsoft.Web/sites",
"location": "[parameters('location')]",
"tags": null,
"dependsOn": [],
"properties": {
"name": "[parameters('name')]",
"siteConfig": {
"appSettings": [],
"metadata": [
{
"name": "CURRENT_STACK",
"value": "[parameters('currentStack')]"
}
],
"phpVersion": "[parameters('phpVersion')]",
"netFrameworkVersion": "[parameters('netFrameworkVersion')]",
"alwaysOn": "[parameters('alwaysOn')]"
},
"serverFarmId": "[concat('/subscriptions/', parameters('subscriptionId'),'/resourcegroups/', parameters('serverFarmResourceGroup'), '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]",
"clientAffinityEnabled": true
}
}
]
}

和参数

{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"subscriptionId": {
"value": "someId"
},
"name": {
"value": "testdotnet5"
},
"location": {
"value": "Central US"
},
"hostingPlanName": {
"value": "ServicePlan43e7dac6-ad18"
},
"serverFarmResourceGroup": {
"value": "recruiterly"
},
"alwaysOn": {
"value": false
},
"currentStack": {
"value": "dotnet"
},
"phpVersion": {
"value": "OFF"
},
"netFrameworkVersion": {
"value": "v5.0"
}
}
}

你应该使用

        "netFrameworkVersion": {
"value": "v5.0"
}

关于azure - 用于创建 NET 5 应用服务的 ARM 模板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64942145/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com