Deploying .NET Framework Applications with Windows Containers on Alibaba Cloud ECS and ACK
This guide explains how to use Windows Containers on Alibaba Cloud ECS and ACK to containerize and run .NET Framework 4.x applications, covering Windows Container basics, Alibaba Cloud image support, step‑by‑step deployment commands, networking, resource limits, and Docker Compose usage.
While .NET Core/.NET 5 applications can run on Docker, legacy .NET Framework 4.x apps require Windows Containers, which became natively supported starting with Windows Server 2016 and improved in Windows Server 2019.
Windows Containers run standard Docker commands and share the same image format as Linux containers, allowing images to be distributed via Docker Hub or private registries such as Harbor.
Alibaba Cloud ECS now provides Windows Server 2019 with Container images, meeting the requirements for .NET Framework apps, and Alibaba Cloud Container Service (ACK) adds Windows Container support with full Kubernetes compatibility, enabling mixed Linux/Windows node clusters.
Quick start steps:
1. Choose an Alibaba Cloud ECS instance and select the Windows Server 2019 with Container image.
2. Connect to the ECS instance and verify Docker is pre‑installed:
> docker version
Client: Mirantis Container Runtime
Version: 20.10.5
API version: 1.41
... (full output omitted for brevity)3. Run a .NET Framework sample container:
docker run --rm mcr.microsoft.com/dotnet/framework/samples:dotnetapp4. Run an ASP.NET WebForm sample, mapping host port 8000 to container port 80:
docker run --name aspnet_sample --rm -it -d -p 8000:80 mcr.microsoft.com/dotnet/framework/samples:aspnetappEnsure the ECS security group allows inbound traffic on port 8000. The container can be accessed via http://localhost:8000 from the ECS console or via the public IP from an external browser.
To inspect the container’s IP address:
docker inspect -f "{{ .NetworkSettings.Networks.nat.IPAddress }}" aspnet_sampleTo enter the container for debugging:
docker exec -it aspnet_sample powershellInside the container, the web files are located at C:\inetpub\wwwroot and can be listed with ls .
Docker Compose can be installed on Windows Server to orchestrate single‑host deployments, using the same commands as on Linux:
Invoke-WebRequest https://github.com/docker/compose/releases/download/1.25.4/docker-compose-Windows-x86_64.exe -UseBasicParsing -OutFile $env:ProgramFiles\docker\docker-compose.exe
docker-compose versionResource limits can be applied, for example limiting an ASP.NET MVC sample to 1 CPU and 1024 MiB memory:
docker run --name aspnet_mvc_sample --rm -it -d -p 8000:80 --cpus 1 -m 1024m reg.edisonzhou.cn/dotnet/samples:aspnetmvcappLocal directories can be mounted into the container for configuration files:
docker run --name aspnet_mvc_sample --rm -it -d -p 8000:80 --cpus 1 -m 1024m -v C:\IIS\config\aspnetmvcapp:C:\inetpub\wwwroot\Configs reg.edisonzhou.cn/dotnet/samples:aspnetmvcappThe article concludes that Windows Container technology, combined with Alibaba Cloud ECS and ACK, provides a practical path to containerize and deploy .NET Framework applications, and previews a future tutorial on building a custom Dockerfile for an ASP.NET MVC app.
YunZhu Net Technology Team
Technical practice sharing from the YunZhu Net Technology Team
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.