Windows Azure Cloud Service (47) modifies the Cloud service time zone

Source: Internet
Author: User
Tags azure sdk

Windows Azure Platform Family of articles Catalog

This article describes the content that is appropriate for Azure global and Azure China

When we use the cloud service, we find that the default cloud service is the UTC time zone.

In many cases, the time zone used by our application is the utc+8 time zone, which is Beijing.

In this case, it is our traditional practice to modify the Aspx.cs code to change the UTC time zone to the utc+8 time zone.

But it takes time and effort, is there a better solution?

  

In fact, we can execute the cmd command in the Azure Startup task to modify the current time zone of the system.

Before starting this chapter, please refer to the author's previous documentation:

Windows Azure Cloud Service (24) Registers COM components with startup (top)

Windows Azure Cloud Service (25) uses startup to register COM components (bottom)

You can have a basic understanding of Azure Startup task.

The tools we need to use in this chapter are:

1.Azure Visual Studio Update4

2. Install the Azure SDK

3.Azure China Account

Let's start with the contents of this chapter.

1. First we run Visual Studio 2013 as an administrator.

2. Create a new cloud Project, name Leicloudservicetimezone, and add Web Role. Entries

3. At the root of project, create a new file and rename it to Changetimezone.cmd

  4. In cloud Project, click changetimezone.cmd, select Right-click Properties, copy to Output directory select Copy always

  

  5. In changetimezone.cmd, set the following logic:

"  China Standard Time "

6. Modify the Servicedefinition.csdef, modify the startup node, and let the Cloud service project start, execute the changetimezone.cmd command. Such as:

  

7. Finally, in the ASPX page, we output the current system time:

Label1.Text = DateTime.Now.ToString ();

8. Finally, we deployed the cloud Service, as shown below:

  

You can see the current time of the deployment, that is utc+8 GMT

Reference: Http://social.technet.microsoft.com/wiki/contents/articles/29554.change-time-zone-of-azure-role-instances-vm-s.aspx

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 (47) modifies the Cloud service time zone

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.