From the book I co-authored, Beginning Windows Phone 7 Development, you will notice in Chapter 3 you will be asked to build Windows Phone 7 Notepad application using Azure as your backend and service tier. Unfortunately, since the book was written Microsoft recently updated the UI of the Azure using Silverlight (Go Silverlight ).
This blog will take you through the Azure’s new interface to deploy WCF Service.
Also if you must you can always go back and forth to new and old by clicking on the link below that says take me back to the old portal as shown below and the Chapter 3 instruction from the book will be still valid
Deploying WCF NotepadService as New Hosted Service
At the end of the blog you will find the source code to the NotepadService and I wont go in detail on how to create WCF service and I will simply use the already created WCF Azure service.
- Open NotepadService in Visual Studio 2010.
- From Solution Explorer Right Click on NotepadService project and choose Publish.
- Choose Create Service Package Only and Click OK as shown below.
- Windows Explorer will open and you will see NotepadService.cspkg and ServiceConfiguration.cscfg which you will be deploying to Azure.
- Go to https://windows.azure.com/ and log in.
- When you log in on upper left click New Hosted Service as shown below
- When prompted with Create a new Hosted Service as shown below fill in following information. 1) From Choose a subscription dropdown you will see multiple if you bought multiple Azure accounts. 2) Enter a name for your service 3) Enter a URL prefix that you will be using to connect to your NotepadService 4) Choose Anywhere in US or if you want to be closer to your database create or choose existing affinity group 5) Choose Deploy to stage environment 6) Typically on Deployment name I use version number 7) Choose NotepadService.cspkg and ServiceConfiguration.cscfg.
- You will receive warning message box for now simply click ok as shown below. Warning has to do with the fact that you only have one instance but you can easily increase this later time.
A warning has been encountered
A warning has been encountered. Click “See more details” to see the warning. Would you like to override and submit?
Warning: This deployment has at least one role with only one instance. We recommend that you deploy at least two instances per role to ensure high availability in case one of the instances becomes unavailable. Doing so also enables coverage of the Windows Azure Compute SLA (http://go.microsoft.com/fwlink/?LinkID=159704&clcid=0x409), which guarantees 99.95% uptime. For more information please visit http://go.microsoft.com/fwlink/?LinkID=202707 (http://go.microsoft.com/fwlink/?LinkID=202707). Find more solutions in the Windows Azure support forum (http://go.microsoft.com/fwlink/?LinkID=206235).
- You will see following where NotepadService is being deployed to the staging.
Eventually, when the deployment is done you will se the service being started in the status column.
About the Deployed Service
When you click on 22.214.171.124 on right side you will see many useful information and one of them is DNS name which you can click and view your service. Also another useful information is IP of the service as well if you are planning to create A pointer or use CNAME to point to your staging. See below for the figure.
Going from Staging to Production and Visa Versa
One of thing you will one to do is going from staging to production and production to staging in order to do this you must first deploy your service to staging and to production because by doing this you receive VIP ( virtual IP) that allows your to SWAP your staging IP to production imp or visa versa. This is nothing more then the networking trick.
- From above you deployed to staging and to deploy to production you can simply click on 126.96.36.199 staging and you will see New Production Deployment Button is enabled top left as shown below.
- When prompted with the Windows just redeploy NotepadService again as shown below.
- When click ok you will be prompted with warning again regarding the one instance as shown below. Click ok and ignore this warning.
- When the status changes to Initializing click on 188.8.131.52 Production and you will see Swap VIP is enabled and same thing happens when you click 184.108.40.206 staging as see below figure.
- When you click on Swap VIP now you have ability to move production to staging or staging to production simply by changing VIP seen below.
In this section you learn about moving from production to staging or staging to production via VIP swapping which is simple networking trick all done by Azure behind the seen. and Making it seamless to the Azure developers like yourself
This blog is somewhat of supplementary information to Beginning Windows Phone 7 Development Chapter 3 specific to the new Azure UI. Hopefully this will help the reader.