How to Deploy WCF Service to Windows Azure?

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 Smile ).

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 Smile


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 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 (, which guarantees 99.95% uptime. For more information please visit (  Find more solutions in the Windows Azure support forum (


  • 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 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 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 Production and you will see Swap VIP is enabled and same thing happens when you click 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 Smile

Download Code


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.

About toetapz

Henry Lee is founder of various start-ups and is passionate about the technology. He is also the author of the book Beginning Windows Phone Development 3nd edition from Apress ( He works with various Fortune 500 companies delivering large multi-million dollar projects. He recently formed start-up company called focusing his energy on delivering mobile applications to the consumers. In his spare time, he dedicates his effort to help his .NET community by delivering sessions at the technology events. He enjoys talking with other technologist about current trends in the technology and sharing business insights with fellow colleagues. Often you will find Henry at local cigar bar enjoying a cigar and a drink trying to come up with next big mobile application.
This entry was posted in Azure, WCF, Windows Phone 7 and tagged , , . Bookmark the permalink.

5 Responses to How to Deploy WCF Service to Windows Azure?

  1. Pingback: Tweets that mention How to Deploying WCF Service to Windows Azure? | Toetapz's Blog --

  2. Pingback: Apress’ “Beginning Windows Phone 7 Development” — Global Nerdy

  3. Daz says:

    I got your book and I’ve tried the example and I’ve tried developing my own version and whether i try to run it locally or deployed to Azure I get the following error message (with slight variation of endpoint depending on what I’m doing).

    Do you have any ideas ?

    There was no endpoint listening at that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

    The function it fails in is in References.cs, the second line

    public System.Guid EndAddUser(System.IAsyncResult result) {
    object[] _args = new object[0];
    System.Guid _result = ((System.Guid)(base.EndInvoke(“AddUser”, _args, result)));
    return _result;

  4. Daz says:

    the other thing I have noticed is in my app, the ServiceReferences.ClientConfig file with the cloud address. The service proxy contains the local Now when i try to change it to the cloud address, it says “downloading information” then it brings up an 2 errors.

    Error1 – unable to connect to remote server because the target machine actively refused XX.XX.XX.XX:80 (ip address disguised). Could this be it ? How do i fix it ?

    Error 2 -There was no endpoint listening at cloude address

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s