6

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

2 Answers 2

4

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:

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.

1
  • The "Differences Between the Compute Emulator and Windows Azure" link died. This appears to be an archived copy: archive.is/GnHoc Jan 30, 2017 at 23:35
2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.