As mentioned in the previous chapter, the Windows azure platform provides two deployment environments for each hosted service: the staging environment and the production environment.
- The web URL generated by the staging environment is composed of guid, which is usually used for testing and internal release sites.
- The web URL generated in the production environment can be specified by the user, which is usually used for commercial use and official release of the site.
- Generally, after developers finish the development, they regret deploying them to the staging environment for testing, and then switch to the production environment through the VIP swap function.
This chapter describes how to create a site in the transition environment and switch to the production environment through VIP swap.
1. Create a Windows azure Project
Create a Windows azure project and right-click "package". For details, refer to Windows azure platform (10) to deploy the local azure project on the cloud server.
2. Create a managed service in Windows azure
Open your browser and go to the Windows azure user management interface. Click create managed service"
In the pop-up "New managed service", make the following settings:
- Select "East Asia" for the Region"
- Select not to deploy
In this way, a hosting service located in the Hong Kong data center has been created.
3. Deploy the transitional environment
Select the new managed service and select "new transitional deployment"
In the displayed "new deployment" window, enter the deployment name and upload the cspkg and cscfg files.
A warning window is displayed when you click "OK" to start deployment. This is because the current ASP. Net only sets one instance and cannot get the high availability of Windows azure 99.95%. Click "yes" Here to ignore the warning and continue deployment.
After the upload is complete, the deployment status is constantly updated on the main interface.
The application status changes to "ready" until the deployment is complete, indicating that the ApplicationProgramIt has been successfully deployed on the Windows azure platform and started.
We can observe that the DNS name shows the domain name corresponding to this hosted service in the staging environment. Because we created a transitional deployment (staging), the domain name is composed of guid.
4. Transition to the production environment
The staging environment of Windows Azure is mainly used for testing. Its URL is related to the deployment ID, so it is not very good. We can switch the staging deployment to the production deployment through the VIP swap function.
Select the previous deployment site and click the swap VIP button in the toolbar.
The displayed Confirmation window lists the information about the hosted service to be switched. You only need to select "OK.
Then the managed service is updated:
The operation will be completed within one minute. Then we can see that our site is in the production environment. The response URL is also set.