This is a simple solution to deploy mORMot server on windows and IIS.

This solution let IIS control ip restrictions, https certificates, logs, etc…, take advantage of the best solution on windows server, save a lot of works for your job.

Steps to deploy:

1)Install httpplatformhander, you can downlaod it from … ormhandler 

2)Create your mORMot server, not as usual, this mORMot server you must not define a const portnum, and the server must be a console application

3) Get port number from ParamStr(1) which passed from commandline

4) Use the port num  to listen the request from IIS.

5) Create a folder and copy your mORMot server exe and files you need

6) Configure IIS with domain and port(usually 80) you want to listen, cerfiticates etc. and set site path to folder where you copied your mORMot server.

7) Create/edit web.config on this folder like this:

<?xml version=”1.0″ encoding=”UTF-8″?>
<remove name=”httpplatformhandler” />
<add name=”httpplatformhandler” path=”*” verb=”*” modules=”httpPlatformHandler” resourceType=”Unspecified”/>
<httpPlatform stdoutLogEnabled=”true” stdoutLogFile=”.\logs\ConsoleOut.log” startupTimeLimit=”20″ processPath=”.\mORMotServer.exe” arguments=”%HTTP_PLATFORM_PORT%”/>

That’s all! You have your app working with IIS!

All you need is a IIS7.5 or up with httpplatformhandler installed.

This handler works as a reverse proxy, passing all requests to our application. Azure has installed this handler on its AppService plataform solution.

Benefits from having our app behind IIS:

– Binding on a especific ip, port and hostheader*

– Manage https certificates*

– Write W3C format log with all received requests

– URL Rewriting

– Every worker can raise an instance of your application

*can be managed with netsh, but with IIS is more simple.

This is the simplest way, but you can configure IIS with ARR (Application Request Routing) as a optional solution.


You are not limited to use mORMot DB server, you can use any base httpserver as THttpServer (Synopse), TidHttpServer (Indy), etc. Every time IIS opens your AppServer exe, it specifies a port number in commandline. Your AppServer needs to get this port number and use to configure httpserver:

Demo code are as followed:

//get port from commandline

Port := ParamStr(1);

//create server with port passed by commandline

myhttpserver := THttpServer.Create(Port,nil,nil,’MyServerName’,8);

Make sure you have installed httpplatformhander on your IIS machine.

Configure your IIS site like this (here you can define ip, port and SSL certificate):

IIS Config

Change web.config file as  above.

Configure your assigned application site AppPool as managed code:

Important: If your application needs write to disk or have access to any special resources, you need to configure appPool with an user with enough permissions.

Use the URL Rewrite IIS module, it’s more flexible.

Follow this tutorial and it’s very easy:

informtions are from the discusstion  at