Wisej.NET Deployment
HomeNewsSupportVideos
  • Deployment
  • Targets
    • IIS
    • NGINX
    • Apache
    • Self Hosted
    • Hybrid
    • Amazon AWS
    • Microsoft Azure
    • ASP.NET Hosting
    • Linux, MacOS
    • Desktop (deprecated)
  • Concepts
    • Load Balancing
    • Visual Studio Publishing
    • Server Debugging
  • Troubleshooting
    • License Activation
Powered by GitBook
On this page
  • .NET Core
  • Basic Steps
  • Security
  • .NET Framework
  • Basic Steps
  • Load Balancer

Was this helpful?

Export as PDF
  1. Targets

Apache

How to publish a Wisej App using Apache as a reverse proxy.

PreviousNGINXNextSelf Hosted

Last updated 3 months ago

Was this helpful?

.NET Core

There are a few steps required to deploy to deploy a Wisej.NET app to on .NET Core. use the following Visual Studio Publishing link to generate a build. Then proceed with Basic Steps.

Basic Steps

  1. After generating a build using the Visual Studio Publishing link above, copy the executable, resource files, and referenced DLLs to the folder they will run in.

  2. Test that the deployment works using the dotnet start AppName command.

If the application is deployed as an executable, ensure the executable has the execute permission and run sudo ./AppName.

httpd.conf
<VirtualHost *:80>
    ServerName myapp.com

    <Location /myapp/>
        ProxyPass http://10.1.10.112:43662
    </Location>

</VirtualHost>

The configurations in this book are minimal examples, use the full Apache guide to determine how to configure your Apache server.

This is all you need for Apache to dispatch the requests to the Wisej.NET application.

Security

When deploying on .NET Core, you are unable to use the web.config file to configure the System.Web.HttpForbiddenHandler, which is typically used to block the downloading of potentially sensitive .json files. As a result, these .json files could become accessible for downloading, which might pose a security vulnerability.

Since ASP.NET Core relies on middleware modules instead of using traditional HttpHandlers and HttpModules, to secure specific files or directories, you need to modify the configuration in the Startup.cs file. Adjusting the middleware settings within Startup.cs allows you to implement security measures to protect sensitive files or directories effectively.

Below is an example of how to block access to specific files or directories in ASP.NET Core, based on your security requirements. You can customize the middleware configuration in the Startup.cs file to meet your particular security needs.

Conditional UseFileServer
// app.UseFileServer();
app.UseWhen(
 cx => !cx.Request.Path.Value.EndsWith(".json", StringComparison.OrdinalIgnoreCase), 
 app => app.UseFileServer()
);

.NET Framework

Basic Steps

  1. Create the application directory on the deployment server

  2. Create the /bin directory in the application's directory on the deployment server

  3. Copy all the assemblies from your local /bin to the server's /bin (no need to copy xml and pdb files)

  4. Copy the /Themes folder if you have custom themes or mixins

  5. Copy the /Images folder if you have images that need to be served as URLs

  6. Copy the /App_Data folder if your application uses it

  7. Copy Web.config

  8. Copy Default.html (and other html files you use sub-applications)

  9. Copy Default.json (and other json configuration files if you use sub-applications)

  10. Copy favicon.ico.

httpd.conf
<VirtualHost *:80>
    ServerName myapp.com

    <Location /myapp/>
        ProxyPass http://10.1.10.112:43662
    </Location>

</VirtualHost>

The configurations in this book are minimal examples, use the full Apache guide to determine how to configure your Apache server.

This is all you need for Apache to dispatch the requests to the Wisej.NET application.

Load Balancer

Apache can also serve as a load balancer out of the box. Instead of setting the ProxyPass property to the actual Wisej server, assign it to a balancer group that defines the load balancing rotation.

<VirtualHost *:80>
    ServerName myapp.com

        Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED
        <Proxy balancer://myapp1>
        BalancerMember 10.1.10.1:52433 route=node1
        BalancerMember 10.1.10.1:52434 route=node2
        BalancerMember 10.1.10.2:52000 route=node3
        BalancerMember 10.1.10.2:52001 route=node4
        ProxySet stickysession=ROUTEID
    </Proxy>
    
    <Location /myapp/>
        ProxyPass balancer://myapp1/
    </Location>

</VirtualHost>

If you are deploying on a distribution or on , make sure is installed.

Starting with Wisej.NET 4, the use of libgdiplus is no longer necessary. This change is due to the development of a new managed System.Drawing library, which has been created in conjunction with .

3. After verifying the app runs, you will need to . systemd can be used to create a service file to start and monitor the underlying web app.

systemd is an init system that provides many powerful features for starting, stopping, and managing processes on Linux systems.

All Apache needs is an address and a port. In the file define the URL for your application and assign the URL:port of the actual Wisej application to the ProxyPass setting.

Deploying a Wisej 2.x application to is similar the the deployment in regards to the files to copy to the production machine.

Notice that step 1 is different from IIS because Apache never loads the actual application, instead it acts as a dispatching requests to the web application listening on another internal port.

The actual Wisej application must be running and listening for requests in a separate process on the local machine or a remote machine. It can be either an process or a process (may also run in a Docker container).

All Apache needs is an address and a port. In the file define the URL for your application and assign the URL:port of the actual Wisej application to the ProxyPass setting.

Note that in the sample above we added a cookie ROUTEID with the name of the node to bind a specific server to a client in order to achieve the required functionality.

👉
Linux
MacOS
libgdiplus
ImageSharp
configure the app to run on startup
Click here to make a service file.
httpd.conf
Apache
IIS
Reverse Proxy
httpd.conf
sticky session
Apache
LogoVisual Studio PublishingDeployment
Generate a build with Visual Studio Publishing
LogoReverse Proxy Guide - Apache HTTP Server Version 2.4
Apache Reverse Proxy Setup
LogoReverse Proxy Guide - Apache HTTP Server Version 2.4
Apache Reverse Proxy Setup
IIS
Logomod_proxy_balancer - Apache HTTP Server Version 2.4
Apache Load Balancer Setup
Self Hosted