In this article I am going to explain how to create ASP.Net Web role in Windows Azure Application.
Follow the steps given below to create or add ASP.Net web role in windows azure:
· Open Microsoft Visual Studio 2010 as an administrator.
· To create a new project File – New – Project.
· Select Cloud template from the Installed Templates.
· Select Windows Azure Project and enter the name of the project as MyWebRole.
· Click OK to proceed.
· To add a web role to the solution, choose ASP.NET Web Role and then choose the right arrow. The roles are displayed in the Windows Azure solution pane of the dialog box.
· Click OK.
The Solution explorer view will look similar to given below. Delete the selected items from the WebRole1 application as shown below:
After deleting the above items add a new Web Form (Default.aspx) in an ASP.Net application.
To add a new web form Right click on the solution explorer – Add – New Item – Select Web form – Enter Default.aspx in the Name TextBox.
After add web form add web.config file in an asp.net application as show below:
Add the following code in Default.aspx to see the output:
<div>
<h2>Welcome! This is my first Web Role Application</h2>
</div>
After adding code Press F5 to in order to debug your application. The output looks like below:
To manage your local deployments, open the shortcut menu for the Windows Azure icon in the notification area and then choose Show Compute Emulator UI.
The Windows Azure Compute Emulator is displayed.
Choose WebRole1 to display the instances of the web role, as shown in the above illustration. Choose a specific instance to view individual instance.
After reading this article you can easily create web role in a Windows Azure Application.
Leave Comment