Category Archives: C++

Running LMDBService WS NoSQL in Azure Container Instance

Now that LMDBService runs in a docker image, it is possible to run it into Azure Container Instance.

Here are the steps to follow:

  • Build the docker image locally with its dockerfile
    • docker image build –tag mydocker/myserver d:\dev\docker
  • Create a Repository in Azure Repository
  • Connect in docker shell to the repo
    • docker login -u lmdbwsprod -p xxxxxxxxxxxxxxxxxxxxxxxxxx
  • Tag the prod repository
    • docker tag mydocker/myserver
  • Push the docker image to the Azure repository
  • Go to Azure portal and choose Azure Repository
    • Choose prod repository
    • Check tags and choose latest
    • Click Run Instance in […] button
    • Open port 7001
    • Click OK
  • Go to Azure Container Instance
    • choose the container and click Overview
    • Retrieve the IP address

Test the URL :



Running a Windows Service with LMDB as a REST Web API Web Server in a Docker container

To make the test, I use the Microsoft/IIS image available at :

This image is managed by Microsoft and regulary updated. Size is around 1.8 GB. To get the image in Docker, run:

  • docker pull microsoft/iis

Then, we to create a Docker file to instruct Docker how to setup the environment :

FROM microsoft/iis
COPY *.* c:/
RUN sc create LMDBService start=auto binpath=”C:\LMDBService.exe”
#RUN net start LMDBService
RUN md c:\temp

Then, we need to build the image :

  • docker image build –tag mydocker/myserver d:\dev\docker

And now, we can run the container as a deamon:

  • docker run -d -p 7001:7001 -it mydocker/myserver

In order to test the Web Server in a browser, we need to know the IP address of the web server… We need to know the IP of the container… We begin by listing the containers :

  • docker ps –a
  • we take the first item of the list

And we run the following command using the id of the container:

  • docker inspect -f “{{ .NetworkSettings.Networks.nat.IPAddress }}” 543e57f54047
  • response is displayed =>

Now we can test the web server in the container.


The container runs the windows service who host the web server… Let’s use this url :


It works !


Microsoft REST SDK Architecture

The architecture of the Microsoft CPPREST SDK is presented here for an article I write for french magazine Programmez.

It explains why the code is multi-platform. It’s based on Boost libraries. Boost is known to be a very good library, state of the art C++.

Need a simple logger in Win32 ?

If you need like me, a logger for your deamons and services… just look at this simple logger:

#pragma once
#include <string>

class CLogger
	virtual ~CLogger();

	void Init(std::wstring name);
	void WriteLog(std::wstring message);

	std::wstring _name;
	std::wstring _path;

You put the name of the file in Init() method as then, you just call WriteLog() ! Let’s ook at the code impl:

#include "stdafx.h"
#include "Logger.h"



void CLogger::Init(std::wstring name)
	_name = name;

	TCHAR szTemp[255];
	_stprintf_s(szTemp, _T("C:\\TEMP\\LOGS"));
	::CreateDirectory(szTemp, NULL);

	TCHAR szPath[255];
	_stprintf_s(szPath, _T("%s\\%s"), szTemp, name.c_str());

	_path = szPath;

void CLogger::WriteLog(std::wstring message)
	std::string path(_path.begin(), _path.end());

	memset(&st, 0, sizeof(SYSTEMTIME));

	TCHAR sz[1024];
		_T("%02d:%02d:%02d.%03d - INFO - %s\r\n"), 
		st.wHour, st.wMinute, st.wSecond, st.wMilliseconds, 

	std::wstring wsz = sz;
	std::string msgToWrite(wsz.begin(), wsz.end());

	HANDLE hFile = ::CreateFileA(path.c_str(), 

	LONG l = 0;
	::SetFilePointer(hFile, 0, &l, FILE_END);
	DWORD dwLen = 0;
		msgToWrite.c_str(), msgToWrite.length(), 
		&dwLen, NULL);



Coding Live at DevCon6 for Programmez Magazine

Monday 25 June 2018, I will be a speaker for a Programmez magazine event.

I will code C live ! It will be about coding LMDB for Windows as a DLL and testing a client that can make 1.000.000 rows in 1 second. Can you say that ?

Make OpenLDAP-LMDB OSS project a DLL

Source code from To make a DLL, it’s just some syntax errors compilation in MSVC 17. But if builds after minor corrections.

Article in Technical Magazine Programmez N° 219 – June 2018

May be in next June edition of french magazine Programmez, an article about creating a Windows Service. All the plumbing ! The second part will explain how to host a deamon inside and respond to external communication.