Shaun Xu

The Sheep-Pen of the Shaun



Shaun, the author of this blog is a semi-geek, clumsy developer, passionate speaker and incapable architect with about 10 years’ experience in .NET and JavaScript. He hopes to prove that software development is art rather than manufacturing. He's into cloud computing platform and technologies (Windows Azure, Amazon and Aliyun) and right now, Shaun is being attracted by JavaScript (Angular.js and Node.js) and he likes it.

Shaun is working at Worktile Inc. as the chief architect for overall design and develop worktile, a web-based collaboration and task management tool, and lesschat, a real-time communication aggregation tool.


My Stats

  • Posts - 122
  • Comments - 622
  • Trackbacks - 0

Tag Cloud

Recent Comments

Recent Posts


Post Categories


It has been long time didn’t blog anything since last November. There are many exciting things happened during this period. I attend Microsoft TechED 2012 China and provided a session about Node.js and Windows Azure. I also provided a small but funny session at the Microsoft China Community New Year Party on this January. Then I enjoyed Chinese New Year at Lvshun, a quiet and beautiful city aside Bohai Bay with my wife, where her hometown is.

But I decided to write something when I read this. On February, Microsoft announced that the Windows Azure Store had just expanded availability to new 25 markets, includes Hong Kong SAR, which is the country/region for my Windows Azure account. This means I can try this fantastic feature with my subscription.


Windows Azure Store

Windows Azure Store is a brand new service provided by Windows Azure platform. It likes a service market, where you can buy services provided by many third-party publishers. With Windows Azure Store, as a developer we can:

1. Choose from popular app services including: AppDynamics (monitoring and scaling as a service), New Relic (performance management and monitoring), SendGrid (email delivery as a service) and more.

2. Find the data your app needs from data providers like: Dun & Bradstreet (business insights), Loqate (Worldwide address verification and cleansing service), StrikeIron (Phone number verification service; Sales and use tax rates lookup service), and more.

3. Connect and manage it all from the developer portal: The integrated store UI makes it easy to find, buy, manage the services and data you need directly from the portal.  Integrated billing means you store purposes are added directly to your Windows Azure account.  We also provide connection strings and sample code and help get you started fast, as well as usage data from directly within the Windows Azure management portal.

Furthermore, there are other benefit of using Windows Azure Store.

1. It utilizes similar UI as Windows Azure portal, which means it’s very easy to select, view and purchase.

2. All services are located in Windows Azure data centers. This means we can choose the best region to minimize our cost.

3. We can view the billing report in our Windows Azure subscription management page.

4. Almost all services in Windows Azure Store provides multiple subscription plan and most of them have free subscription.


Windows Azure Store and Windows Azure Marketplace

If you had playing with Windows Azure a while, you might heard that there’s another feature in Windows Azure called Windows Azure Marketplace, where you can buy data and applications published from other venders. It sounds very similar as Windows Azure Store. So what’s different between them? Will Windows Azure Marketplace be replaced by Windows Azure Store.

Here I would like to quote some clarification from Ryan McGee at Microsoft.

The Windows Azure Store and Windows Azure Marketplace will continue to co-exist; there is not a plan to converge them. The reason is, they serve different audiences and they contain different kinds of products.

The Windows Azure Store makes it easy to find and purchase add-ons, and use them to create your applications. While the Windows Azure Marketplace is an online market where ISVs and data publishers can publish and sell finished applications and premium datasets to business customers.

So my understanding is, if you are going to build your application on Windows Azure and want to leverage some services Windows Azure doesn’t provide, you’d better look for the Windows Azure Store. But if you are going to use some data, or you want to find some applications, you can seek in Windows Azure Marketplace.


Node.js + MongoDB by Using Windows Azure Store

Now let’s take a look on how to use Windows Azure Store. In this post I would like to demonstrate how to build a simple website by using Node.js and MongoDB.


As you know, Windows Azure doesn’t offer MongoDB. Before Windows Azure Store was announced, we have to run our own MongoDB service in a work role or in a virtual machine. This is OK but we have to take care for installation, configuration, scaling, etc.. Now we have Windows Azure Store so let’s check if there’s some MongoDB related services. Open the Windows Azure portal, from the navigate click ADD-ONS, and then click the PURCHASE ADD-ONS.


Now we can see the services in the Windows Azure Store. Scroll down the list and we will find a service named MongoLab, which is MongoDB-as-a-Service. Click next icon at the bottom right of the dialog.


Then we can choose the purchase plan. Currently there’s only one free plan for MongoLab which includes one 0.5G MongoDB. Select the valid Windows Azure subscription, specify our MongoDB name and choose the region. This is where our MongoDB will be provisioned.


Then in the last step, review our selection and clicked the PURCHASE icon.

If you found in the last step it said “We’re sorry, we cannot estimate the bill at this time.” this because you had registered Windows Azure Marketplace with different country/region. To solve this issue, you can log in the Windows Azure Marketplace and change the country/region to the one your Windows Azure subscription is.

After several seconds our MongoDB will be established in that region.


The connection information can be retrieved by clicking the CONNECTION INFO button at the bottom. We will use this information in our Node.js application later.



Next, we will create a new Windows Azure Website and write our Node.js code. Ref how to use Windows Azure Website and publish through local GIT, please refer my previous post. Just ensure that we specify the same region when creating website so that the network traffic will not be billed.


After cloned it to local disk we will add the .gitignore and package.json files. The content would be like this.

   1: node_modules
   1: {
   2:   "name": "nodemongotest",
   3:   "version": "1.0.0",
   4:   "dependencies": {
   5:     "mongoose": "~3.5.7",
   6:     "express": "~3.1.0"
   7:   }
   8: }

And then install “express” and “mongoose” modules through NPM command. “mongoose” is the module we are going to use to connect our MongoDB.

For more information about the “mongoose” module please refer its website.

Then, create our Node.js source code file named “server.js” and paste the code from below. Make sure to replace the MongoDB connection string by your MongoDB connection information in line 16.

   1: (function () {
   2:     "use strict";
   4:     var app = require("express")();
   5:     var server = require("http").createServer(app);
   7:     var mongoose = require("mongoose");
   8:     var Schema = mongoose.Schema;
   9:     var ObjectId = Schema.ObjectId;
  11:     var guestSchema = new Schema({
  12:         client_ip: String,
  13:         request_date: String
  14:     });
  16:     var conn = mongoose.createConnection("mongodb://");
  17:     // var conn = mongoose.createConnection("mongodb://");
  18:     var GuestItem = conn.model("GuestItem", guestSchema);
  20:     var guestCount = function (req, callback) {
  21:         // retrieve the client request ip and date
  22:         var request_date = (new Date()).toString();
  23:         var request_ip = req.header('x-forwarded-for') || req.connection.remoteAddress;;
  24:         // try to insert into mongo
  25:         var guest = new GuestItem;
  26:         guest.client_ip = request_ip;
  27:         guest.request_date = request_date;
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati
  •   Short Url:

  • Comments

    Gravatar # re: Consume Third-Party Services at Windows Azure Store
    Posted by new relic pricing on 1/24/2015 12:36 AM
    A special thanks for this informative post. I definitely learned a few new things here.
    Gravatar # re: Consume Third-Party Services at Windows Azure Store
    Posted by Tasmini on 6/26/2015 12:28 AM
    Thanks for your posting on this blog. From my experience, periodically softening way up a photograph may well provide the photography with a little an imaginative flare. Many times, however, that soft clouds aren’t precisely what you had at heart and can sometimes spoil a normally good photograph, especially if you intend on enlarging this. Commodity Online Tips
    Gravatar # re: Consume Third-Party Services at Windows Azure Store
    Posted by Rahjani Roya on 7/13/2015 11:00 PM
    Thank you so much for giving everyone an extremely memorable possibility to read critical reviews from this website. Some 1 areas in this article are basically the finest we’ve ever had.

    It is often very useful plus packed with fun for me and my office colleagues to visit your site at the very least 3 times in one week to learn the fresh guides you will have. And lastly, we are usually motivated with the great things served by you.
    Gravatar # re: Consume Third-Party Services at Windows Azure Store
    Posted by Shana on 7/25/2015 4:06 AM
    Yo, nice post, It's brilliant!!! Keep on writing more stuffs like this! :-) Take a look over here to find out some interesting things.
    Gravatar # re: Consume Third-Party Services at Windows Azure Store
    Posted by Apoorva Singh on 8/17/2015 10:06 PM
    This is the fitting blog for anybody who needs to seek out out about this topic. You realize a lot its almost laborious to argue with you (not that I really would want…HaHa). You definitely put a new spin on a topic thats been written about for years. Great stuff, simply great!

    At last I can have found something from this post which feels pretty good. Khelomcx
    Gravatar # re: Consume Third-Party Services at Windows Azure Store
    Posted by Lovish on 11/24/2015 10:06 PM
    I have always used simple words in my post. This was overall a very informative article. A great post………… important thing is to apply it!
    MCX Bullion Tips
    Gravatar # re: Consume Third-Party Services at Windows Azure Store
    Posted by technicalstock on 4/6/2016 5:03 PM


    Technical stock Research Stock market advisory company Stock market research trading tips services for Indian stock market Commodity,Equity, Gold Silver , Gives dauly porfin in stock market aprox 10 to 15 k

    Gravatar # re: Consume Third-Party Services at Windows Azure Store
    Posted by on 4/6/2016 5:04 PM

    Gravatar # re: Consume Third-Party Services at Windows Azure Store
    Posted by Aswin on 5/3/2016 11:10 PM
    Its sound good, The Windows Azure Store provides developers with third party app services and data (add-ons) that complement and extend core Windows.
    Gravatar # re: Consume Third-Party Services at Windows Azure Store
    Posted by kailash on 6/22/2016 7:13 PM
    Always so interesting to visit your site.What a great info, thank you for sharing. this will help me so much in my learning..

    share shoppe
    Gravatar # hindi board
    Posted by faiq on 7/28/2016 10:19 PM
    Native american dramas in the earlier days were being performed having males looking nicely put together as gals. There was great deal of melodrama along with the story brand was dependant on folk myths or Hindu mythology. hindi board

    Gravatar # italian marble supplier
    Posted by raj gupta on 8/9/2016 8:28 PM
    I want you to thank for your time of this wonderful read!!!italian marble supplier
    Gravatar # affordable luxury travel
    Posted by angel on 8/9/2016 8:29 PM
    I am just pretty happy to sign up ones own guestbook these days,affordable luxury travel
    Gravatar # re: Consume Third-Party Services at Windows Azure Store
    Posted by Rohan Singh on 10/25/2016 5:50 PM
    I'm the one that's got to die when it's time for me to die, so let me live my life the way I want to aamod resort shimla
    Gravatar # Sociology writing service
    Posted by Albert Thomas on 1/13/2017 2:39 PM
    I personally like your post, you have shared good article. It will help me in great deal.
    Sociology writing service

    Gravatar # Wilson Larrie
    Posted by Online Homework Help on 1/13/2017 3:42 PM
      I loved the way you discuss the topic great work thanks for the share.
    Online Homework Help

    Gravatar # Web Content Writing Service
    Posted by Brian Joseph on 1/13/2017 5:59 PM
    it's really nice and meanful. it's really cool blog. Linking is very useful have really helped lots of people who visit blog and provide them usefull information.

    Gravatar # provillus finasteride hair loss treatment
    Posted by Viagnunda on 1/14/2017 12:47 PM
    dc5320 viagra safety jr1102r
    Gravatar # re: Consume Third-Party Services at Windows Azure Store
    Posted by MarkCPhillips on 1/16/2017 11:05 AM
    This is such a great resource that you are providing and you give it away for free. I love
    seeing that understand the value of providing a quality resource for free.
    bloons tower defense 5
    super smash flash 2

    Gravatar # Matured site
    Posted by ameliaby69 on 1/16/2017 6:52 PM
    New gay place
    gay naruto atlantis gay cruise free gay chat site gay chatline gay gifts
    Gravatar # Test, just a test
    Posted by XRumerTest on 1/16/2017 11:13 PM
    Hello. And Bye.
    Gravatar # Как купить любой тур в теплые страны за пол цены? База продавцов супер-туров!!!
    Posted by Alltraveler on 1/31/2017 6:53 AM
    Эксклюзивный товар, такого Вам никто не предложит в интернете.

    Если Вы заядлый путешественник, то моя инструкция для Вас.
    Вы узнаете как приобрести практически любой тур за половину цены,
    а в некоторых случаях и за 40% от цены. Экономия - десятки тысяч рублей.
    И самое интересное Вы сможете продавать эти туры со своей наценкой знакомым, либо
    просто рекламировать среди незнакомых людей. Это реальный шанс неплохо заработать на перепродаже дешевых туров.
    Плюс самим летать по миру за копейки.

    Продам всего 20 копий материала , так что если Вы реально заинтересовались, то советую поторопиться.

    Представляем базу продавцов туров на эксклюзивных условиях.
    К примеру отель 4-5* Тайланд - 40 000 рублей на двоих 10 дней с перелетом.
    Приобрести инструкцию можно здесь

    P/S Кроме этого на ресурсах которые я Вам дам, Вы сможете приобрести брендовую одежду
    за 50% от цены магазина, телефоны, часы и т.д. Поверьте там очень много всего.
    Gravatar # re: Consume Third-Party Services at Windows Azure Store
    Posted by Rickie on 11/30/2017 11:23 PM
    Azure is already getting overshadowed by, you guessed it!
    get free SoundCloud plays
    Post A Comment