Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows azure web role on local IIS

I am developing windows azure web role. Can I host the azure web role on my local IIS.

If yes..what are the steps I need to follow ?

Local Machine is currently running on windows server 2008 R2

like image 278
usr021986 Avatar asked Jul 31 '13 10:07

usr021986


People also ask

Do Azure web Apps use IIS?

Yes, when you publish to Azure App Services, IIS is used to host your application.

Can you host Azure locally?

Azure is a cloud-based service and cannot be installed on your local machine. First, Azure requires a subscription and a computer with an appropriate hardware configuration. Second, you must have the Azure services installed on your computer in order to use Azure.

What are roles in Microsoft Azure web role?

There are two types of Azure Cloud Services roles. The only difference between the two is how your role is hosted on the VMs: Web role: Automatically deploys and hosts your app through IIS. Worker role: Does not use IIS, and runs your app standalone.


2 Answers

There are two ways to achieve that, with varying levels of fidelity to the target environment.

The simplest is just to run your website project locally. You can attach it as a virtual directory on IIS and run it from the browser or debug it from Visual Studio. This will run as a regular IIS web application, but it won't be running as a web role.

The second is to package your application as a cloud service and run it under the Windows Azure Compute Emulator installed on your development machine. There are several tutorials on how to do that, including:

  • Developing and Deploying Windows Azure Cloud Services Using Visual Studio - see "Debugging a Windows Azure Application Locally".
  • Run a Windows Azure Application in the Compute Emulator
  • Windows Azure Basics–Compute Emulator
  • Building the web role for the Windows Azure Email Service application - 3 of 5
  • How-to deploy application to Windows Azure Compute Emulator with CSRUN

The Compute Emulator simulates several features of Windows Azure Cloud Services, but yout have to be aware of Differences Between the Compute Emulator and Windows Azure. Your application can tweak its behavior according to the environment by reading the RoleEnvironment.IsAvailable and RoleEnvironment.IsEmulated properties.

like image 195
Fernando Correia Avatar answered Oct 07 '22 17:10

Fernando Correia


The Compute Emulator uses IIS Express locally for your dev/test work. IIS Express should be already set up for you when you installed the SDK+Tools. (Older versions of the SDK relied on full IIS 7 - more info here).

If you're talking about developing for running in production locally: It doesn't exactly work this way. A web role translates to a Windows Server virtual machine with some startup scaffolding code to allow you to install things in your VM, tweak the registry, etc. Since web role instances are stateless, every time a new instance is launched, the startup script is executed (same if an instance crashes due to hardware failure and is brought up again on another machine).

If you want to run the web app itself locally, then you'd need to take specific actions, based on whether your code is executing in Windows Azure or on a local machine (and then package it a bit differently - you wouldn't include the web role project). You can check RoleEnvironment.IsAvailable + RoleEnvironment.IsEmulated to help you out.

like image 35
David Makogon Avatar answered Oct 07 '22 16:10

David Makogon