We have been undergoing a major upgrade to our tech stack and here is what we are implementing now…  WOOT WOOT



žCloud Formation – A service that allows the entire stack to be built, provisioned, provisioned, and torn down demand.

žELB – A load balancer that works with autoscaling to create and destroy servers as needed by the traffic load.

žEC2 – Cloud-based virtual machines.

žEFS – A network file system that allows multiple EC2 instances to share a file system, even across availability zones.

žS3 – A Simple Storage Service designed to hold static resources, such as images and documents.

žRDS – Relational Database Services that cross availability zones, provide high availability, provide fail-over, and provide backup.

MVC-API with Windows CE Embedded 6


Previously I posted about using a Web-API to import data from another vendor’s products into our database. One of my goals for our team has been to move away from using direct calls into our database be it by either .NET ADO, Linq or SQL commands and instead expose a means for all products to get their data needs via a service. When we built a mobile application; which is a Single Page Application, I rolled out a MVC-API using Microsoft’s framework for this. Our first big pay off on adaptability and cross platform use proved out when we needed to support a RFID Device made by Motorola. This device uses a Windows CE Embedded operating system. Below I will quickly cover how I coded to connect to the API from this device.

First things first…

I had tried to store the API url’s on the device in a XML file, but watch out because xml does not like the & symbol in any value. You can use things like & or %26 inline, but Windows CE in-application-browser does not seem to like this very much… My work around was to store the values on the device’s SQL Lite instance.

Now moving on, as you know an API will have an end point you send your query to.
For example:


The above api, requires a school id so you can pull the correct schedule for that school/site.

In my example, I will show how I pulled a set of inventory tags down from the API site.

I have a basic method called GetTags

The api is called, several helper methods help pull the data and parse it and eventually inflate a List with POCO objects called TagItem which is a simple class with Getters and Setters.

public static List<TagItem> GetTags(string ApiURL,int SiteUId)


string uri = String.Format(“{0}/api/Inventory/GetTags?siteUId={1}”, ApiURL, SiteUId);

return JsonConvert.DeserializeObject<List<TagItem>>(GET(uri));


As you can see we pass in the GENERIC API URL and pre-pend it to the API Signature.

The real meat here is the GET method which in turn uses the GetBaseRequest and other helper methods. I will post the code below since it should be fairly obvious what it is doing…

private static string GET(string pUri, int pTimeOut)


HttpWebRequest request = null;

string retValue = “”;



request = GetBaseRequest(pUri, “GET”, “application/json; charset=utf-8”, pTimeOut);

retValue = ReadRequestResponse(request);


catch (Exception)




return retValue;


private static HttpWebRequest GetBaseRequest(string pUri, string pMethod, string pContentType, int pTimeout)


System.Net.ServicePointManager.CertificatePolicy = new TrustAllCertificatePolicy();

HttpWebRequest request = (HttpWebRequest)WebRequest.Create(pUri);

request.Headers.Add(“Authorization”, Token);

request.Method = pMethod;

request.Proxy = null;

request.KeepAlive = false;

request.Timeout = pTimeout;

request.ContentType = pContentType;

request.UserAgent = “Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)”;

return request;


private static string ReadRequestResponse(HttpWebRequest pRequest)


string retval;

HttpWebResponse response = (HttpWebResponse)pRequest.GetResponse();

using (Stream responseStream2 = response.GetResponseStream())

using (StreamReader reader = new StreamReader(responseStream2))

retval = reader.ReadToEnd();


return retval;


That is the meat of it, hope that helps someone else. If you have questions please let me know.