azure - 用于创建 NET 5 应用服务的 ARM 模板
问题描述
我有一个创建 Azure 应用程序服务的 ARM 模板,它适用于 .NET Core,但我现在想更新模板以部署 NET 5 应用程序服务,我没有任何运气。这是 ARM 架构:https ://docs.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"
}
推荐阅读
- swift - 如何使用 Swift 从 Firebase DB 参考路径中删除观察者?
- javascript - Jquery ui 对话框多次加载
- curl - 使用 open_ssl 和 curl 验证服务器证书
- kendo-ui - 如何编辑不属于网格列的网格弹出窗口中的字段?
- java - javafx.scene.control.TextArea.clear() 不清除显示的文本
- c# - 用户控件不更新某些属性
- c# - 如何加载 Newtonsoft.Json 符号
- python - Python 3 中基于可靠队列的线程间消息传递
- c# - 解码 NTLM 授权数据包?
- php - ldap_modify 不工作 PHP