Self Hosted
How to run a Wisej app as a self-hosted process or service.
Last updated
How to run a Wisej app as a self-hosted process or service.
Last updated
Wisej 3 .NET Core applications are self-hosted by default being standard ASP.NET Core applications. ASP.NET Core apps are built to an executable that you can simply start and will start hosting your application. You don't need to use Wisej.HostService.exe.
If you are deploying on a Linux distribution or on MacOS, make sure libgdiplus is installed.
Run the publishing tool to deploy to a folder.
That's it. When you run YourApplication.exe you can use the --urls command line argument to configure the application's endpoints.
Wisej 3 ASP.NET Core apps can be deployed as a Windows service quite easily:
Add the WindowsServices nuget to your project.
Add builder.Host.UseWindowsServices() to Startup.cs or Startup.vb (see code snippet below).
Register the service using "sc create"
Now you can start the service like any other Windows service. For any additional configuration option refer to the Microsoft documentation.
You can run a Wisej application (including Wisej 3 on .NET 4.8) 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.
Create the application directory
Copy Wisej.HostService.exe to the application directory
Create the /bin directory in the application's directory
Copy all the assemblies from your local /bin to the server's /bin (no need to copy xml and pdb files)
Copy the /Themes folder if you have custom themes or mixins
Copy the /Images folder if you have images that need to be served as URLs
Copy the /App_Data folder if your application uses it
Copy Web.config
Copy Default.html (and other html files you use sub-applications)
Copy Default.json (and other json configuration files if you use sub-applications)
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.
Register the executable to run as a service:
You can start the same service multiple times listening on different ports.
Used in conjunction with a load balancer like NGINX, you can have multiple processes of the same application handle their share of the sessions.
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.
Starts the process listening for connections to localhost on port 8080 (the default).
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.
Once the web.config file includes these settings it can be used with IIS, self hosting, standalone, and Ultidev/Cassini deployments.