通过 AWS Elastic Beanstalk 向 Windows 服务器配置添加功能

Add feature to Windows Server Configuration by AWS Elastic Beanstalk

我的应用程序使用 WebSocket 协议,我想使用 AWS Elastic Beanstalk 将它部署到 AWS。但预构建 Windows 服务器配置默认不包括此协议。

我可以通过添加角色和功能向导(Web 服务器 (IIS) -> Web 服务器 -> 应用程序开发 -> Web 套接字协议)在服务器管理器中设置相应的项目来手动启用它。

如果我想让我的应用正常运行,我需要通过 RDP 连接并手动选中此选项。但这是一个糟糕的方法..

我认为这个任务可以通过部署设置(.ebextensions)来完成?但是我怎样才能得到它?

非常感谢您的回答!

添加.ebextensions to your EB environment and customize your server software

You may want to customize and configure the software that your application depends on. These files could be either dependencies required by the application—for example, additional packages or services that need to be run.

根据您的需要使用 commands 选项:

Use the commands key to execute commands on the EC2 instance. The commands are processed in alphabetical order by name, and they run before the application and web server are set up and the application version file is extracted.

The specified commands run as the Administrator user.

例如,此命令将安装 WebSocket 协议功能:

%SystemRoot%\system32\dism.exe /online /enable-feature /featurename:IIS-WebSockets

在 .ebextensions 配置中它可能看起来像:

commands:
   01_install_websockets_feature:
     command: "%SystemRoot%\System32\dism.exe /online /enable-feature /featurename:IIS-WebSockets"
     ignoreErrors: true