When using DataEase server as a Live Internet server, the best way is to use it behind another web server like IIS. This will then take care of named server, logging and SSL for you. The DataEase server is good at one thing and that is to serve DataEase pages and data fast and secure. The configuration and the rest we let the others take care of. The live server can take the same startup parameters as the development server.

Setting up a DataEase application on the server

To set up a Live Server you install the DataEase live server package. Then you need to add a valid license file to C:\ProgramData\DataEase\deserver9

Setting up the app as a service

Copy an application developed in the development server to the server.

In the server forlder usually located at C:\Program Files (x86)\DataEase\deserver9 you will find the nssm.exe file that we use to set up and monitoring the services. The best way to use the server it to make a batch file for each server instance you want to start. In this way you can test i manually before adding it to the nssm monitor. You also need to start it in user mode at least once to see the port the service starts on.


We copy our app named MyTestApp to C:\Users\Administrator\Documents\My DataEase\MyTestApp

Then we locate C:\ProgramData\DataEase\deserver9 and add MyTestApp.bat with the following code

@echo start MyTestApp
"C:\Program Files (x86)\DataEase\deserver9\deserver" "C:\Users\Administrator\Documents\My DataEase\MyTestApp" MyTestApp

Then start this once in to get the correct port from the server and see that all works (you can also reach the application in for testing purposes on the server)

Next step i to add the batch file as a service. This is done using nssm command found in C:\Program Files (x86)\DataEase\deserver9

Use C:\Program Files (x86)\DataEase\deserver9\nssm install aservicename to add a service with the name aservicename and open the GUI to add your batch file. Use names that are easy to remember and find in services. I use DES_AppName for all mine. DES for DataEase Server.

C:\Program Files (x86)\DataEase\deserver9\nssm install DES_MyTestApp
You can skip the GUI by using
C:\Program Files (x86)\DataEase\deserver9\nssm install DES_MyTestApp C:\ProgramData\DataEase\deserver\MyTestApp.bat

Now you are ready to set it up in a remote proxy using IIS so you can use proper web addresses, SSL and more than one service pr. server.

Setting up IIS as front-end server

The setup has taken inspiration from this and this document.

Setting up IIS on a new server

- First add IIS Web Server as a Role in Add Roles and Features on the server manager.

- On 2012R2 these are the steps:

- Start Server Manager

- In Dashboard under Configure this local server select Add roles and features

- Select Role-based or feature-based installation

- Select your the server in Server Selection

- In Select server roles find Web Server (IIS) and select it and next dialog let Include management tools be checked and press Add Features

- Features select Next

- Web Server Role (IIS) select next

- Role Services you should check HTTP Redirection as this you probably will need to redirect to https and then press next or install it from here

- On the confirmation page press Install

- When done press Close

Next steps before we can use the IIS web server

- Start Internet Information Services (IIS) Manager (from now IIS Manager) and say Yes to get started with Microsoft Web Platform

- Start Get New Web Platform Components from the right side menu in IIS Manager and Install this extension

- Start Web Platform Installer

- Select Server in Web Platform Installer and install URL Rewrite module

- If you not already have selected the ARR (Application Request Routing) do so, can also be installed from here

Adding and editing sites

Change the first default site to match your own

There is already an default site that is active now for all requests to your server. 

You can use this one by renaming it to your site name and edit the Binding under Edit Site action on the right and add the named server is should respond to. The field to change is Host name. When you add a server name to this field the server will only answer requests to this name. The default server is set up to respond to http at port 80. You can change this by adding new bindings. You can then later remove the binding to port 80 if you do not want it to be active. 

If you want to use DataEase server with SSL look further down in the document.

Adding new sites

To add a new just select Sites and use Add Website from Actions at the right. 

Fill inn your site name, add the same for host name and change the bindings if you not want default port 80 for all IP's on your computer

Add a folder under C:\inetpub with the same name as the site

Edit security in the folder and add IIS_IUSRS with Read & execute, List folders contents and Read to the folder.

You can reach all of this from the Actions menu on the right in Internet Information Services (IIS) Manager

Connecting your application to the site

Now you have a app server up and running and a IIS site but there is no connection between them.

- select the site you want to use for the web application and select URL Rewrite (if you can not find the icon, you might have to close and open IIS manager after installing it to let it register)

- add rule and select Reverse Proxy and say OK if you get a dialog about Application Request Routing

-  In Inbound Rules add your application address including the port number Ex.

- Keep Enable SSL Offloading

- Check Outbound Rules and add the same address to From and your server name for use on the internet and the same as setup in binding for To. Ex. demo.dataease.no

Setting up SSL for the application

In the DataEase server package we have added win-acme with the letsencrypt.exe file. This can be used for getting free basic ssl certificates and install them. This is the only method described in this document, but you can do it manually in the standard IIS way if this is not what you want.

Open command prompt

change folder to C:\Program Files (x86)\DataEase\deserver\win-acme2 where the executable files for letsencrypt are located

run wacs from the command prompt

select N for new

Select 1 for Single binding of an IIS site

Select the site you want to get certificate for from the list of sites on the server

Select binding if you get that question, usually 1 will do and then just select the server with the binding set.

if this is the first time you have to enter some information for use by Letsencrypt

 - email

 - agree on license of win-acme (no on first to show pdf and yes to second to agree)

the certificate is fetched and installed on your server in ProgramData\win-acme

a schedule for renewal is set up that will fetch and install a new one in Task Scheduler with the name win-acme...

Setting up http to https redirect

Some times you only want the server to be accessible form https. This is how you set up a rule to redirect all requests from http to https:. This one makes are rule that will redirect any request the is not https to https. Also a reverse rule that take them all to https.

Open IIS Manager and select the sit to redirect to https.

Select URL Rewrite and "Add Rule(s)..." to add a Blank rule

Give it a name like "Redirect to HTTPS"

In the Match URL section set:

Requested URL: Matches the Pattern
Using: Wildcards
Pattern: *
Ignore case: Checked

In Conditions section set:
Logical grouping: Match Any

Press "Add" and add to the dialog
Condition input: {HTTPS}
Check if input string: Matches the Pattern
Pattern: OFF
Ignore case: Checked
Track capture groups across conditions: Not checked

Leave Server Variables blank
In Action section set:
Action type: Redirect
Redirect URL: https://{HTTP_HOST}{REQUEST_URI}
Append query string: Not checked (since this already are a part of REQUEST_URI)
Redirect type: Permanent (301)

After Apply make sure to move it to the top as this needs to be done before any other rule

Setting up path to other server in site

Some times you need to let the server offload some services to another server. Ex. seach server. Then you will need to make it appear like the same site. To do this you will have to create some rewrite rules on your site that comes before the general remote proxy defined earlier in this document. 

To do this you have to dine an inbound and a outbound rule. 

Inbound rule

Add rule from Inbound rules and select "Blank rule".

Name the rule something that fits the purpose with suffix Inbound. Ex SearchInbound. In this example we set up a reverse proxy on incoming /search/* to the root at another server. In this example this server responds to and it should have whatever comes after /search/ in the site.

Under Match:
Pattern: search/(.*)
Let conditions be as default.
Append querystring yes
Stop processing of subsequent rule set to true

Move this rule up over the general reverse proxy that will take any request.

Outbound rule:

Add rule and select Blank rule from Outbound rules.

Name it something that says what it does and add suffix OutBound. Ex SearchOutbound. In this example we want to just rewirte the url to the domain server with /search/ as the path. Ex https://server.name.domain/search/



Matching scope:
Match content within:
Not needed for me but will usually be A, Form, Img
Content: Using:
Matches the Pattern RegEx
Pattern: ^http(s)?://*)
Action Properties