azure - Azure - 从 ARM json 模板设置 WebSocket
问题描述
我正在尝试从部署我的整个基础架构的 Azure ARM json 模板为 Azure WebApp 打开 WebSockets。
这是关于 Azure Web App 的摘录。它不起作用,即 WebSockets 仍然关闭。我没有成功尝试不同的拼写:webSocketsEnabled
或WebSockets
。
"resources":[
{
"name": "[variables('MyApp')]",
"type": "Microsoft.Web/sites",
"location": "Brazil South",
"apiVersion": "2016-08-01",
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', variables('MyAppPlanBrazil'))]"
],
"tags": {
"[concat('hidden-related:', resourceId('Microsoft.Web/serverfarms', variables('MyAppPlanBrazil')))]": "Resource",
"displayName": "MyAppAppBrazil"
},
"properties": {
"name": "[variables('MyAppPlanBrazil')]",
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('MyAppPlanBrazil'))]",
"siteConfig": {
"AlwaysOn": true,
"webSocketsEnabled": true,
"connectionStrings": [
{
...
},
{
...
},
]
}
}
]
更新
正如下面的答案中所建议的,我将其更新apiVersion
为"2016-08-01"
但这仍然不起作用。另请注意,虽然我的架构是此处描述的架构,但apiVersion
在 VS 中是波浪形的,它表示授权值"2015-08-01"
仅为。
更新2
我尝试了以下解决方案。他们为他们的作者工作,但不为我工作。我想问题出在其他地方。我的基础架构已经部署,我尝试使用webSocketsEnabled
. 而在下面的解决方案中,我想作者直接使用webSocketsEnabled
.
此外,我的 web 应用程序webSocketsEnabled
的alwaysOn
定价层不允许“AlwaysOn”(正如门户网站中所说,我需要升级才能使用该功能),所以我会尝试不使用alwaysOn
.
更新3
最后,上面的模板在我删除AlwaysOn
. 感谢那些试图帮助我的人。
解决方案
将您的 api 版本设置为:“2016-08-01”
利用
“webSocketsEnabled”:真
这是来自 Microsoft.Web/sites 模板参考:
https://docs.microsoft.com/en-us/azure/templates/microsoft.web/sites
您使用的 api 版本 (2015-08-01) 来自:
其中没有网络套接字,但后者:
有 webSocketsEnabled。
推荐阅读
- angular - ngOnInit 在 Angular 5 的所有继承类中多次调用
- ios - 我们如何在容器中水平居中视图?
- python - 从侦听套接字/HTTPServer 获取传入 URL
- javascript - PHP - 显示移动摄像头以捕获 QR 码
- spring-boot - 如何在 Spring Boot 中为 /favicon.ico 设置 Strict-Transport-Security 标头
- c - C上下文切换堆栈变量损坏
- selenium - Azure DevOps 如何在 Windows 托管代理上运行 Linux Docker 容器
- django - Django在创建数据库时创建对错误表的外键引用
- azure - 在外部表中选择几列
- mongodb - 从基本文档集中删除重复文档以进行聚合