DEV Community

Cover image for Azure vs GCP part 3: Compare Web Apps and App Engine as Linux platform
Kenichiro Nakamura
Kenichiro Nakamura

Posted on

Azure vs GCP part 3: Compare Web Apps and App Engine as Linux platform

So far I just deployed dotnet core web application to Azure and GCP without thinking about underline OS. Therefore, naturally, I deployed my app to Windows hosted environment in Azure. In this article, I use Web Apps on Linux to see how they are different.

.NET support

As it's Linux, only dotnet core is supported. I use same application I use in the part 1 of this series.

Deploy to Azure Web Apps on Linux

When you deploy dotnet 2.0 application to Web Apps, there are two choices.

  • Use docker container
  • Use dotnet 2.0 runtime

Let's see how docker container deployment works. By the way, I couldn't successfully deploy to dotnet 2.0 runtime environment but I will explain steps anyway.

Docker for Windows

Windows now supports docker, but you need to install it.
Docker for Windows. You need hardware which supports Virtualization. I believe most PC does now though.

Deploy as docker container

1. To use docker, you need to enable it. This could be done at project creation time or later like this article. Right click project | Add | Docker Support.

2. Select "Linux" as Target OS.

3. Now the solution has docker-compose project. Right click project and click "Publish". Click "Create new profile".

4. Visual Studio 2017 detects docker support and gives us Linux (or even Container Registry) option. Select "Microsoft Azure App Service Linux" and click "Publish".

5. Create new resource group and app service plan. One caveat here.

  • Web Apps on Linux requires App Service plan for Linux, which requires separate resource group.
  • There is no "Free" plan for Linux platform.

So I specify new resource group and "S1" app service plan here. Please note the app service plan name as you use it later.

6. Then just wait. This takes a bit of time, so grab coffee if you want. Meanwhile, Visual Studio creates resources in Azure, push image to registry, and deploy it.

7. Once deploy completed, access to the Site URL.

Deploy to dotnet core 2.0 runtime

Web Apps also provides dotnet core 2.0 runtime environment. It works pretty same as Windows environment. However, Visual Studio doesn't support direct push like docker version.

Let's create new Web Apps by re-using the resource group created above. I use CLI capability embedded in portal.

1. Go to Azure Portal and click "Cloud Shell" icon on top menu bar.

2. Run following command to create new Web Apps on Linux. Replace plan name to you created above. And Web App name needs to be globally unique. The '--deployment-local-git' parameter tells the Web Apps that I use git push to deploy.

az webapp create -g $rgname -p $planname --name $webappname --runtime "dotnetcore|2.0" --deployment-local-git
Enter fullscreen mode Exit fullscreen mode

3. Copy the git url which is displayed right after the last command. Address looks like below.

4. Run following command to create deploy user. The username needs to be globally unique.

az webapp deployment user set --user-name <username> --password <password>
Enter fullscreen mode Exit fullscreen mode

5. If you didn't initialize git yet, right click solution and select "Add Solution to Source Control".

6. Go to "Team Explorer" and click "Sync".

7. Select "Publish Git Repo".

8. Enter the git address you obtained in previous step and click "Publish".

9. Enter username and password you set in previous step, and wait until push completes. It takes time for initial push.

Well, this should work, but I encounter an issue that I couldn't successfully deployed by using this method. I may miss something or temporary issue? Anyways this is the error I got.

As we can deploy via Git, we can easily deploy via Visual Studio 2017 or shell.

GCP App Engine Flexible

I already deployed the application to App Engine in part 1. Is there anything I was missing? Of course. In this article, I just add one more information.

Customize App Engine Flexible environment.

As tested in part 1, it is straight-forward to deploy to App Engine Flexible. But if you want to customize the environment, you can do so.

1. As I already mess up the project by adding docker support in previous step, let's re-create new application from scratch. I created "WebApplication2" project.

2. Right click Project and select "Generate app.yaml and Dockerfile".


3. app.yaml and DockerFile are created. Then you can modify the file and publish. For example, you can specify how many instances you want and resource for each instance.

runtime: aspnetcore
env: flex

  instances: 3
  cpu: 2
  memory_gb: 2.3
  disk_size_gb: 10
Enter fullscreen mode Exit fullscreen mode


It's interesting to find that experience varies even in same platform. I strongly felt that I cannot avoid container technology as a developer.


Introduction to Azure App Service on Linux
Deploy an ASP.NET container to a remote Docker host
Configuring your App with app.yaml


Top comments (0)