“参数LinuxFxVersion具有无效值"从Node.js创建WebApp资源时 [英] "The parameter LinuxFxVersion has an invalid value" when creating WebApp resource from Node.js
问题描述
我试图在Node.js环境中使用适用于JS的Azure SDK创建一个简单的WebApp,但是我一直得到响应:
I am trying to create a simple WebApp using the Azure SDK for JS in a Node.js environment, but I keep getting the response:
{
"Code":"BadRequest",
"Message":"The parameter LinuxFxVersion has an invalid value.",
"Target":null,
"Details":[
{"Message":"The parameter LinuxFxVersion has an invalid value."},
{"Code":"BadRequest"},
{"ErrorEntity": {
"ExtendedCode":"01007",
"MessageTemplate":"The parameter {0} has an invalid value.",
"Parameters":["LinuxFxVersion"],
"Code":"BadRequest",
"Message":"The parameter LinuxFxVersion has an invalid value."}
}],
"Innererror":null
}
我尝试了各种不同的属性和环境,但均未成功.我总是会收到此错误.这是我正在使用的TypeScript代码的片段:
I've tried a variety of different sets of properties and environments with no success. I always get this error. Here's a snippet of the TypeScript code I am using:
const wsmClient: WebSiteManagementClient...
const webAppName: string...
const servicePlanId: string...
const rgName: string...
const envelope: Site = {
name: webAppName,
location: 'westus2',
kind: 'app,linux',
serverFarmId: servicePlanId,
siteConfig: {
linuxFxVersion: 'JAVA|11-java11'
}
};
const appResp = await wsmClient.webApps.createOrUpdate(
rgName,
webAppName,
envelope
);
我在做什么错了?
推荐答案
原因:
您的应用服务计划不是Linux,实际上是Windows.Windows主机没有参数LinuxFxVersion.
Your app service plan is not Linux, actually it's Windows. Windows host doesn't have parameter LinuxFxVersion.
如果我们在未将主机明确配置为Linux的情况下创建站点,则默认情况下它将是Windows主机/serverFarm/app服务计划.仅使用{"kind":"linux"}.
If we create a site without explicitly configuring the host as Linux, it will be a Windows host/serverFarm/app service plan by default. Using {"kind":"linux"} is not enough.
解决方案:
在Linux中明确定义应用程序服务计划,并确保 {"reserved":true}
将其设置为Linux主机(
Explicitly define the app service plan in Linux, and make sure {"reserved": true}
to set it as a Linux host (See documentation)
{
"type": "Microsoft.Web/serverfarms",
"apiVersion": "2019-08-01",
"name": "[parameters('hostingPlanName')]",
"location": "[parameters('location')]",
"kind": "app,linux",
"properties": {
"reserved": true
},
"sku": {
"Tier": "[parameters('hostingPlanSkuTier')]",
"Name": "[parameters('hostingPlanSkuName')]"
}
}
这篇关于“参数LinuxFxVersion具有无效值"从Node.js创建WebApp资源时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!