Azure Web Role in Azure Cloud Service

Kailash Chandra Behera | Monday, December 14, 2020

Introduction

Azure web role is one of the roles provided by azure cloud service to run the applications in the Azure portal that need IIS. here in this article, we will learn what is Azure web role and how to create an Azure cloud service with azure web role using visual studio.

Getting Started

Before starting a discussion about the azure web role, lets us discuss a little about the Azure cloud services.

Azure Cloud Services is a complete development and deployment environment in the cloud, with resources that enable you to deliver everything from simple cloud-based apps to sophisticated, cloud-enabled enterprise applications.

Cloud services help in deploying azure-manged Virtual Machines with attached workloads. The cloud services help in deploying code as Virtual Machines like Azure App Service. However, you have more control over the VMs. You can install your own software on VMs that use Azure Cloud Services, and you can access them remotely.

An application can be a set of worker role or web role instances within a cloud services deployment.

Web Role and Worker Role

  1. Azure Web role:

    Automatically deploys and hosts your app through IIS. we will take a look at a sample application leveraging the web role.

  2. Azure Worker role:

    Does not use IIS and runs your app standalone. To know more details about the worker role visit my article(Azure Worker Role)

Create an Azure Cloud Service with Azure Web Role

The following are the detailed steps to create a simple cloud service using azure web role in visual studio.

  1. Open visual studio, go to the File menu, and click on the new->project.

  2. The new project window will appear, search for “Azure Cloud Service”.

  3. There you will find two many options for different languages for example “Azure Cloud Service C#”.

    Azure Cloud Service
    Azure Cloud Service
  4. Choose the Azure cloud service with the language you want, give a name to the cloud service then click on the OK button.

  5. Choose ASP.NET Web role as seen in the following image.

    azure web role
    Web Role and Worker Role in Azure
  6. The New ASP.NET Web Application window will appear, select MVC as a project template then click on the OK button.

  7. Your project is ready now, you can view the web role structure in solution explorer as shown in the below image.

    Azure Web Role
    Web Role
  8. Now you are done with the Web role project template, you can start code for your ASP.NET MVC Application.

  9. You will find the WebRole.cs class file which is the startup class of the project, like the program.cs class in .netframework project.

  10. Run the application. You will see the default page up and running.

Summary

In the above, we discussed what in Azure cloud service, Azure web role and how to create cloud service with web role. I hope you have enjoyed it a lot.

Thanks


No comments: