Windows Azure Platform Family of articles Catalog
This article will briefly describe how to migrate existing ASP. NET applications from the enterprise to the Azure PAAs platform.
Because in the process of migration, it may be necessary to re-architect the existing application, this article is simply introduced, pioneering ideas, the specific application needs specific research and analysis.
1. First you need to download the Azure SDK. Use Visual Studio to create a new cloud Service that includes existing ASP. NET application pages in cloud project.
2. Modify the user sessions (session).
The Cloud service load balancer (Balancer) cannot hold the session. We need to save the session to SQL Server or other external storage media.
Refer to my previous blog post: Windows Azure Cloud Service (13) How to process ASP. Instance scenarios in multiple VMS
The contents of the inside are somewhat outdated, and can be summarized in the following ways to achieve a hold session (Sticky-session)
(1) The session is stored in SQL Server table, and later maintenance of the data table requires the user to implement the relevant business logic.
(2) Save the session in the cache. such as the In-bound cache for cloud service, or the Redis cache for Azure overseas
3. Include the DLLs that need to be called in Cloud Project, and set the copy toOutput Directoryin the properties tocopyalways.
In this way, DLLs that need to be called are packaged directly into Cspkg and uploaded to the Azure cloud for invocation at deployment time.
4. Include the third-party software that you want to install in cloud project, and set the copy to Output Directory in the properties to copy always.
Add The startup task to the Servicedefinition node and perform a "silent" installation in the cmd file.
The Azure PAAs platform is a non-persistent VM, and any software that is installed through Remote Desktop is not valid. We need to include third-party software in cloud project and upload it to the azure cloud at deployment time.
The function of startup is to execute the cmd command each time the PAAs VM is reset, to install the third-party software on the newly created PAAs VM.
The purpose of the "silent" installation is to install it directly and no configuration is required.
Refer to the previous blog post: Windows Azure Cloud Service (22) Registering COM components with startup (top)
5. Save the file upload download in azure storage
Typically, the client uploads the file locally to the server side, and the file is stored on the server's local disk.
However, Azure PAAs is a non-persistent VM, and any files saved on the local disk will be at risk of loss. We need to modify the server's file read/write API to work with Azure storage and save the file in Azure storage.
6. Modification of server-side system time
In general, the server-side time zone is the utc+8 time zone, which is displayed in Beijing time.
The time zone for Azure PAAs is the UTC time zone, and if we call system time at the PAAs layer, there will be a gap with Beijing time.
There are two types of solutions in general:
(1) in the cmd command in the startup task, set the time zone of the current PAAs VM to the utc+8 time zone
(2) In Azure Cloud project, the code that gets the current system time is modified to get the time of the current utc+8 time zone
7. Modify the Web. config configuration of cloud project to Azure Cscfg and Csdef
In a traditional ASP. NET application, the configuration files we read are typically placed in Web. config and are
system.configuration.configurationsettings.appsettings["Settingname"] to read the configuration file.
In Windows Azure, we can also write configuration files to the Web. config. But because our web app is actually run by Azure VM remote Hosting, if we need to modify the configuration file we have to Telnet to the desktop and then modify the Web. config file under IIS. Management is very complex.
So in general, the configuration file for the Windows Azure project is written to the Cscfg file. It is then read by Roleenvironment.getconfigurationsettingvalue ("Cscfgname").
This allows us to make modifications directly from the Configuration deployment window without requiring Remote Desktop to modify the Web. config for the site or republish the Azure site.
For specific reference: Windows Azure Cloud Service (9) configuration change and notification mechanism
8. Splitting the business logic of the Web app into web role or worker role
In a traditional ASP. NET application, the front-end display and the complex logic are all contained in a Web applicatio.
We can put the front-end display logic on the Web Role for the actual application situation, and the back-end load business processing in the worker Role. Enables split of front-end display and business logic.
Bo-Three Stone Blog (hereinafter referred to as Benbow), at the end of this blog article at the bottom of the right is not noted reproduced, source, provenance of the works (content) are the original, the site for the original content of the copyright reserved, do not arbitrarily reproduced, if the need for a friend can send mail contact me; reproduced original works (content ) must also follow the Creative Commons agreement "attribution-non-commercial use-consistent", be sure to indicate or retain the original source of the article and the information of the blogger (Lei Zhang) in the form of a text link, and be sure to keep in mind that the photograph works on this blog (www.cnblog.com/ Threestone) and other relevant watermark copyright information, otherwise deemed to infringe the original Copyright Act; Benbow declined commercial website reprint. All rights reserved, prohibit illegal and malicious plagiarism which violates the copyright protection Law of the People's Republic of China and related laws and Benbow (legal) statement.
Windows Azure Cloud Service (39) How to migrate an existing web app to the Azure PAAs platform