Run a Windows Azure Application in the Compute Emulator
Updated: November 13, 2013
The Windows Azure SDK includes the Windows Azure compute emulator. The compute emulator is a local emulator of Windows Azure, so that you can build and test your application before you deploy it. Some differences exist between how applications run locally compared to how applications run in Windows Azure. For more information, see Differences Between the Compute Emulator and Windows Azure.
To use the compute emulator, you must download and install the Windows Azure SDK.
The user interface of the compute emulator shows the deployments of your applications in an interactive format. You can examine the configuration of a cloud service, its roles, and its role instances. From the user interface, you can run, suspend, or restart a service. In this way, you can verify the basic functionality of your service.
Prerequisites for running the Windows Azure Compute Emulator and the Windows Azure Storage Emulator
You must ensure that your system meets the following minimum requirements to run the Windows Azure compute emulator and the Windows Azure storage emulator:
64-bit edition of Windows 7 or Windows Server® 2008
The 32-bit (x86) version of the SDK requires a 32-bit edition of Windows 7, Windows Vista SP1 or higher, or Windows Server 2008.
Important The 32-bit version of the SDK cannot be installed on a 64-bit operating system; running the SDK under Microsoft Windows 32-bit-On-Windows-64-bit (Wow64) is not supported.
Microsoft .NET Framework 3.5 SP1. You may also optionally install the .NET Framework 4.
Microsoft SQL Server™ Express 2005 or SQL Server 2008 R2 Express for running applications that use the storage emulator. You may also run the storage emulator against a local instance of Microsoft SQL Server; see Configure SQL Server for the Storage Emulator for more information.
If you are intending to use a web role in your application, you must enable Internet Information Services (IIS) 7.0 with ASP.NET. You can enable these features when you install the SDK.
Configure operating system features to emulate Windows Azure
The Windows Azure compute emulator requires that you run IIS 7.0 with ASP.NET, but not all of the role services of IIS 7.0 and not all of the features of Windows Server 2008 are installed by default. The services and features that are installed by default are a subset of the services and features that are installed in Windows Azure. Most basic services can run in the compute emulator; however, when creating more advanced services you may need to take additional measures to ensure that your service will behave in the same ways in the cloud as it does when running in the compute emulator.
Trace the flow of your application
Tracing is a way for you to monitor the execution of your application while it is running. You can use the System.Diagnostics.Trace, System.Diagnostics.Debug, and System.Diagnostics.TraceSource classes to record information about errors and application execution in logs, text files, or other devices for later analysis.
Package and run the application
To run a Windows Azure application in the compute emulator from the command-line, you must first package the application in the appropriate format using the CSPack Command-Line Tool and then use the CSRun Command-Line Tool to start the application in the compute emulator.
Change the configuration of a running application
You might need to test the scalability of your service by adding more running instances of a role. You do not need to stop a running service to add new role instances. To do this, you modify the configuration file for the service by using Visual Studio, or your preferred editor, and then you update the running service by using the CSRun Command-Line Tool.
Compute emulator limits
The compute emulator imposes the same limits on deployment that are found in an initial Windows Azure subscription. The limits are:
Minimum number of roles per deployment is 1.
Maximum number of roles per deployment is 25.
Maximum number of input endpoints per deployment is 25.
Maximum number of internal endpoints per deployment is 25.
Maximum core count is 20.
The compute emulator imposes this additional limit to the maximum number of role instances per deployment of 50.
IP address and port allocation
Web role deployments are allocated different increasing IP addresses, starting with get 127.0.0.1, while trying to maintain the port specified in the service definition file. If the service definition file defines two web role deployments and specifies that they use port 8081, the compute emulator would attempt to assign 127.0.0.1:8081 and 127.0.0.2:8081 as the endpoints.
If the port specified in the service definition is in use, then compute emulator tries to allocate an alternate port by monotonically increasing the given port number until one is available. In case of port ranges, the compute emulator tries to allocate a range within which there’s at least one port available.
For example, if port 80 is specified in service definition and is in use by another process, but port 81 is free, the web role deployment is allocated 127.0.0.1:81. The compute emulator will issue a warning that the port in use and unavailable to be allocated as defined in the service definition. The warning appears on the console through CSRUN.exe tool, and in the “Output” window” (“View”->”Output”) for Visual Studio users.
|Prior to Windows Azure SDK 1.5, web role deployments were allocated the same IP address – 127.0.0.1, using different increasing port numbers to differentiate between the roles. Hence two web role deployments would get 127.0.0.1:81 and 127.0.0.1:82, for example.|
ConceptsUse the Windows Azure SDK Tools to Package, Run, and Deploy an Application
Configure Your Local Environment to Emulate Windows Azure
Run an Application in the Compute Emulator from the Command-line
Change the Configuration of a Running Cloud Service
Other ResourcesIIS Servers in the Compute Emulator
Configuring the Compute Emulator to use Full IIS in Visual Studio