You are not logged in.
Pages: 1
This is a simple solution to deploy mORMot server on IIS and let it control ip restrictions, https certificates, logs, etc...
Instructions to deploy:
- Create you mORMot server to get port number to listen from commandline first parameter.
- Install httpplatformhander https://www.iis.net/downloads/microsoft … ormhandler
- Create a folder and copy your mORMot server exe and files you need
- Configure IIS with domain and port you want to listen, cerfiticates etc. and set site path to folder where you copied your mORMot server.
- Create/edit web.config on this folder like this:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<remove name="httpplatformhandler" />
<add name="httpplatformhandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified"/>
</handlers>
<httpPlatform stdoutLogEnabled="true" stdoutLogFile=".\logs\ConsoleOut.log" startupTimeLimit="20" processPath=".\mORMotServer.exe" arguments="%HTTP_PLATFORM_PORT%"/>
</system.webServer>
</configuration>
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.
Offline
This is a simple solution to deploy mORMot server on IIS and let it control ip restrictions, https certificates, logs, etc...
Thank you very much! Very nice way to deploy custom .exe WebServers using IIS as frontend web server.
Offline
Hi, Exilon!
Please explain a bit more this method, I am very beginner in this area.
My test is not working. If possible send a mini mormot server source and explain IIS setting (convert to application, where set domain, port?)
Thanks, Csaba
Offline
Great! A very helpful reference!
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
Hi, Exilon!
Please explain a bit more this method, I am very beginner in this area.
My test is not working. If possible send a mini mormot server source and explain IIS setting (convert to application, where set domain, port?)
Thanks, Csaba
Hi HollosCs,
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:
//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):
Change web.config file as i metioned 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.
Offline
Hi, I'm back.
-Make an default, minimal THttpServer, read first param for port number
-Create directory, copy server.exe
-create web.config, set my server name
-Make new website and setting application pool
But in the browser: server not found
Nothing work. What I write the url bar?
Offline
Please don't put such big amount of log inside the messages.
See again the rules https://synopse.info/forum/misc.php?action=rules
Especially if they don't show anything but a shutdown server.
From the logs, the server started, then immediately closed.
I guess that your code just do that: start the server, then free it.
Offline
I use the URL Rewrite IIS module, I guess it's more flexible.
Follow this tutorial and it's very easy: https://tecadmin.net/set-up-reverse-proxy-using-iis/
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
Hi, I use httpplatformhandler and it's ok if it's configured on the root of the site, but if I try on a subdirectory of the main site it does not work. Is there no way to configure the httpplatformhandler in a subfolder? If there must be other services (no mormot) in other subfolders in the same site, is it not possible to use httpplatformhandler?
Offline
Pages: 1