Self Hosting
How to run a Wisej app as a self-hosted process or service.
You can run a Wisej application as a self hosting process or service. All you need to do is deploy the Wisej.HostService executable in the root folder of the deployment directory.

Basic Steps

  1. 1.
    Create the application directory
  2. 2.
    Copy Wisej.HostService.exe to the application directory
  3. 3.
    Create the /bin directory in the application's directory
  4. 4.
    Copy all the assemblies from your local /bin to the server's /bin (no need to copy xml and pdb files)
  5. 5.
    Copy the /Themes folder if you have custom themes or mixins
  6. 6.
    Copy the /Images folder if you have images that need to be served as URLs
  7. 7.
    Copy the /App_Data folder if your application uses it
  8. 8.
    Copy Web.config
  9. 9.
    Copy Default.html (and other html files you use sub-applications)
  10. 10.
    Copy Default.json (and other json configuration files if you use sub-applications)
  11. 11.
    Copy favicon.ico.
Wisej.HostService is currently only available in GitHub - you need to download the source code and compile the executable.
Once the deployment directory is ready, you can either register Wisej.HostService.exe as a Windows service, or run it directly as a normal process.
Self Hosting uses the classic pipeline instead of the integrated pipeline in web.config. If the classic configuration is not already present in your web.config, you need to add it. See the web.config section below to see what to add.
These are the supported startup arguments:
(none) or -start
Starts the host process for the current Wisej application: where the process is located.
-stop
Stops the process for the current Wisej application
-p:{port} or -port:{port}
Changes the port. The default is 8080.
-d:{domain name} or -domain:{domain name}
Limits the domain: i.e. * = all, or localhost to accept local connections only. The default is *.
-i or -install
Installs Wisej.HostService as a Windows service for the current Wisej application.
-u or -uninstall
Uninstalls Wisej.HostService from the Windows services.
-n:{name} or -name:{name}
Changes the name of the service, otherwise Wisej sets the name to “Wisej.HostService: “ + {Name of Wisej Application Folder}
Listening on port 80 may be restricted by the OS unless the process is started as Administrator.

Service

Register the executable to run as a service:
1
>Wisej.HostService -i -p:8181
Copied!
You can start the same service multiple times listening on different ports.
1
>Wisej.HostService -i -p:8181
2
>Wisej.HostService -i -p:8182
3
>Wisej.HostService -i -p:8183
Copied!
Used in conjunction with a load balancer like NGINX, you can have multiple processes of the same application handle their share of the sessions.

Process

Run Wisej.HostService.exe as any other process. You can configure Windows to start the process at startup or use Windows Task Scheduler or any other means to start the process.
1
>Wisej.HostService -d:localhost
Copied!
Starts the process listening for connections to localhost on port 8080 (the default).

Web.Config Classic

If your web.config file doesn't include the <system.web> section (classic pipeline), add it as shown in the example below. All it needs is the definition of the Wisej httpModule. under <system.web> and to turn the validation of the integrated mode in <system.webServer>, otherwise IIS will throw in an error.
1
<configuration>
2
...
3
<system.web>
4
<compilation debug="false" />
5
<httpRuntime targetFramework="4.8" maxRequestLength="1048576"/>
6
<httpModules>
7
<add name="Wisej" type="Wisej.Core.HttpModule, Wisej.Framework"/>
8
</httpModules>
9
</system.web>
10
...
11
<system.webServer>
12
<validation validateIntegratedModeConfiguration="false"/>
13
...
Copied!
Once the web.config file includes these settings it can be used with IIS, self hosting, standalone, and Ultidev/Cassini deployments.
Last modified 2mo ago
Export as PDF
Copy link