本文介绍了如何通过 Azure 资源管理器设置 Azure 应用服务以在 .Net Core 上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用以下 ARM 模板片段设置了应用服务:

I've set-up an App Service using the following ARM template snippet:

{
  "name": "[variables('webBackEnd')]",
  "type": "Microsoft.Web/sites",
  "location": "[parameters('location')]",
  "apiVersion": "2015-08-01",
  "dependsOn": [
    "[resourceId('Microsoft.Web/serverfarms', parameters('hostingPlanName'))]"
  ],
  "tags": {
    "[concat('hidden-related:', resourceId('Microsoft.Web/serverfarms', parameters('hostingPlanName')))]": "Resource",
    "displayName": "BackendWebApp"
  },
  "properties": {
    "name": "[variables('webBackEnd')]",
    "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('hostingPlanName'))]"
  }
},

这将部署应用服务.但是,默认情况下,它将设置为使用 .Net 框架.下面是来自我的 Azure 门户的视图:

This will deploy an App Service. However, by default, it will be setup to use the .Net Framework. Below is a view from my Azure Portal:

为了运行基于 ASP.Net Core 的 Web 服务器,我必须手动将堆栈设置从.Net"切换到.Net Core".这是一件微不足道的事情,但我更愿意通过 ARM 模板正确配置它.我搜索了 微软的文档 但无法找到正确的属性.如何做到这一点?

In order to run my ASP.Net Core-based web server, I have to manually switch the Stack Settings from ".Net" to ".Net Core". It's a trivial thing to do, but I'd much rather configure it correctly through the ARM template. I searched Microsoft's docs but was unable to find the correct property. How does one go about to do this?

推荐答案

以下是从门户创建示例 Web 应用程序时的外观:

here's how an example web app looks when created from the portal:

{
    "apiVersion": "2018-02-01",
    "name": "[parameters('name')]",
    "type": "Microsoft.Web/sites",
    "location": "[parameters('location')]",
    "properties": {
        "name": "[parameters('name')]",
        "siteConfig": {
            "appSettings": [],
            "metadata": [
                {
                    "name": "CURRENT_STACK",
                    "value": "[parameters('currentStack')]"
                }
            ]
        },
        // redacted some values
    }
},

当前堆栈值为dotnetcore

这篇关于如何通过 Azure 资源管理器设置 Azure 应用服务以在 .Net Core 上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 18:08