Run an Azure Application in the Compute Emulator
Updated: August 21, 2014
The Azure SDK includes the Microsoft Azure compute emulator. The compute emulator is a local emulator of 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 Azure. For more information, see Differences Between the Compute Emulator and Azure.
To use the compute emulator, you must download and install the 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.
|When you use Visual Studio to run the emulator, the Emulator Express version is enabled by default. You can change this setting in the Web properties of the Visual Studio project. For more information, see Using Emulator Express to Run and Debug a Cloud Service Locally.|
You must ensure that your system meets the following minimum requirements to run the Microsoft Azure compute emulator and the Microsoft 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.
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.
The Microsoft 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 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.
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.
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.
The compute emulator imposes the same limits on deployment that are found in an initial 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.
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 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.|