Only this pageAll pages
Powered by GitBook
1 of 18

Wisej.NET Deployment

Loading...

Targets

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Concepts

Loading...

Loading...

Loading...

Troubleshooting

Loading...

Deployment

Wisej.NET can be deployed in several ways, with or without a web server:

  • Internet Information Server (IIS) is the most common deployment target.

  • Cloud deployments, such as Amazon AWS, Microsoft Azure, …

  • Most modern ASP.NET Provider.

  • and as reverse proxies.

  • Desktop Application through the deployment.

  • Local service or process through the deployment.

  • Containerized deployment using or any other Windows container technology.

Version 2.x of Wisej.NET can only be deployed on Windows machines. Linux is supported starting from version 3.0.

Usually, the deployment is just a matter of copying the correct files to the target machine and configure the web server to recognize the deployed folder as an application.

We cover each scenario in this document, the most common are:

NGINX
Apache
Standalone
Self Hosting
Docker
IIS
Microsoft Azure
Amazon AWS
ASP.NET Hosting

Server Debugging

Sometimes you may need to debug an application in production. Which means you have to debug the server, somehow.

The best way is to install Visual Studio on the server and attach to the web server process (for IIS) or to the application's process when deployed as a standalone app.

Remote Debugging

Visual Studio supports remote debugging, allowing you to connect to the production machine with Visual Studio running on your development machine.

Please note that some Azure deployments support Visual Studio remote debugging natively, you just and to enable it.

ASP.NET Hosting

How to publish a Wisej app to a commercial ASP.NET provider.

Commercial ASP.NET hosting providers are virtually all using IIS and a web administration tool like or . The deployment process is identical to a standard IIS deployment.

Locate the httpdocs or equivalent directory using the control panel, the follow the basic steps below:

  • Create the application directory

  • Create the /bin directory in the application's directory

Hybrid

Beginning with Wisej.NET 3.5, we introduced the new Wisej.NET Hybrid system, which is built upon our hybrid MAUI client. This system leverages the capabilities of the .NET Multi-platform App UI (MAUI) to provide a seamless and integrated application development experience, allowing developers to build more versatile applications that can run across various platforms efficiently.

With Wisej.NET Hybrid, you can deploy a Wisej.NET application locally on iOS, Android, macOS, Linux, and Windows. This platform allows you to write your code exclusively in C# or VB.NET and maintain a single code base for all these platforms.

Wisej.NET Hybrid, when on .NET Core, also supports running applications entirely on the local device, enabling a fully offline mode.

OS
Online
Offline (.NET Core)
Offline (.NET Fx)

Amazon AWS

How to publish a Wisej app on the Amazon AWS cloud.

Amazon AWS doesn't provide an IIS service. The only way to deploy an ASP.NET or a Wisej application is to create an instance of a Windows Server machine, enable IIS and follow the guide or the guide.

AWS also provides its own . Wisej is fully compatible with Amazon's Elastic Load Balancing (including WebSocket support).

You can also try using the AWS toolkit to deploy to AWS directly from Visual Studio:

We have not tested this option. Please follow Amazon's documentation and report any issue directly to AWS support.

License Activation

Troubleshoot license activation issues.

In some scenarios, the license can't be validated.

Potential Issues During License Activation

  1. Network Connectivity: Ensure a stable internet connection.

  2. License Limit: Verify the license hasn't exceeded its activation limit.

  3. Incorrect License Key: Double-check the entered key for any typos.

  4. Firewalls/Antivirus: These might block the activation process; consider temporary disablement.

  5. Black-listed domain: Contact us for more information on what IPs and Domains to whitelist.

The "wisej-server.lic" file might become corrupted or be replaced by an outdated version on your server, causing the Invalid License popup to appear.

To mitigate this issue, we advise that you start by:

  1. Deleting any old wisej-license.lic file.

  2. Restarting the server.

  3. Set the wisej-server.lic file to read-only.

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.

  • Test deployment in a GoDaddy hosted ASP.NET account

    If the hosting provider supports IIS Publishing, you may use Visual Studio to publish the web site directly to the hosting provider's system.

    Prerequisites

    Wisej, like most ASP.NET applications, needs to run in Full Trust mode and needs write permissions to the system's /temp directory. When using the web hosting control panel, locate the ASP.NET Settings section and set the CAS trust level to Full.

    We tried over a dozen commercial ASP.NET providers with Wisej applications without any major issue.

    cPanel
    Plesk

    Android

    MacOS

    Linux

    Windows

    For more information, visit the Wisej.NET Hybrid documentation.

    iOS

    IIS deployment
    Visual Studio Publishing
    load balancing service

    Linux, MacOS

    When deploying using .NET Core on a Linux distribution, or on MacOS, you have to make sure that libgdiplus is installed.

    There are several ways to install libgdiplus depending on the distribution. If using apt-get, this is the preferred installation script:

    sudo apt-get update && apt-get install -y apt-utils
    sudo apt-get install -y libfontconfig1
    sudo apt-get install -y libgdiplus

    We also recommend the installation of Microsoft's fonts:

    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 ImageSharp.

    In case the scripts fail, please search online on how to install libgdiplus and microsoft fonts on Linux or MacOS, and contact our support if you have a different solution.

    You will need to manually add the Web.Config file to the publish directory. In Linux builds, the purpose of the Web.Config file is to provide the server key and the initial theme.

    In recent version of RHEL based Linux distributions, (e.g. CentOS), the SHA1 encryption scheme was deprecated, and that could lead to issues with activating the server license.

    To fix this issue, you'll need to run the following command update-crypto-policies --set LEGACY.

    Note: The Linux distribution used in this tutorial video is Ubuntu 22.04.2 LTS. You can get information about which Linux distribution you are using by running the command lsb_release -a

    Microsoft Azure

    How to publish a Wisej app to the Microsoft Azure cloud.

    Microsoft Azure supports different deployment types for Wisej (ASP.NET) applications. You can deploy to a Web Site (renamed to Web Service), to an IIS instance or a to a Virtual Machine with IIS.

    In all cases you can publish directly from Visual Studio. Please refer to the guide and to Microsoft's Azure Deployment documentation for ASP.NET.

    Project Formats

    sudo apt-get update; apt-get install -y ttf-mscorefonts-installer fontconfig
    Old Project Format

    Supported Frameworks for Publishing

    • .NET Framework v4.x

    SDK-Project Format

    Supported Frameworks for Publishing

    • .NET Core

    You cannot publish .NET Framework v4.x projects to Azure using the Visual Studio Publishing Tool with the new SDK-Project format.

    Troubleshooting

    .NET Core

    The application was published successfully but shows an error 'Couldn't find Wisej.Framework' on startup.

    Remove <add name="Wisej" type="Wisej.Core.HttpModule, Wisej.Framework" /> from <modules> in web.config.

    The application was published successfully but shows a blank white screen on startup.

    Make sure <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" /> is uncommented under <handlers> in web.config.

    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.

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

    Load Balancing

    How to configure Load Balancing with Wisej.

    Wisej applications are standard web applications and work very well with load balancers. However, Wisej goes a step further and gives you additional features to manage the load across several servers.

    You can configure each server running a Wisej application to accept a maximum number of sessions, or to be available for the load balancer only if the CPU load is below a certain percentage and/or the memory usage is below a certain level.

    Sticky Sessions

    Wisej needs the requests from clients to always be routed to the same server instance. This is usually achieved by configuring your load balancer to either use Sticky Sessions, or another type of routing that guarantees that a specific server instance is assigned to a user.

    Sticky Sessions is also called "Session Affinity".

    There are several ways to configure the session affinity feature (sticky sessions):

    1. Cookie generated by the load balancer

    2. Cookie generate by the application and configure the load balancer to use that cookie

    3. Client IP hash

    Refer to your load balancer documentation to learn how to enable Session Affinity.

    WebSocket

    Most load balancers don't enable WebSocket support by default. You have to locate in the documentation how to turn on WebSocket support.

    Wisej works perfectly well in HTTP-only mode, it just loses the ability to push updated to the client without a request initiated by the browser.

    See and to learn how to emulate push updated in HTTP-only mode.

    Failover/Rotation

    This is a unique feature only available in Wisej. Through the healthcheck.json file and the callback you can control when to take a specific server offline or return it to service.

    Failover works by returning the status at the very first HTTP request for the application's HTML page (usually Default.html): the server has to "fail" at the very first request for the failover feature in the load balancer to kick in and resubmit the request to the next server in the rotation.

    To implement this feature, Wisej processes the first HTTP request and, before dispatching the request to the application, checks in order:

    1. to verify that the healthcheck system is enabled.

      • The default in the built-in healthcheck.json file is false.

    2. The return value from as returned by the custom function that you may have installed.

    If the final result is false, the server will return the error code configured in (the default is 503 Server Unavailable).

    HealthCheck.json

    Add a custom HealthCheck.json to your application using Add -> New Item -> Wisej 2 -> HealthCheck.

    You can also create the file manually. The default file is created and initialized like this:

    Values set in HealthCheck.json are also available, to read and to write, in the static class Wisej.Core.HealthCheck.

    Please note that in Wisej 3 the property maxMemory will change to represent an absolute value in MB.

    HealthCheck.IsServerAvailable

    This is a placeholder for a custom function that you can install simply by assigning the property to a function. Usually the best place is Program.Main, but you can assign it or change it at any time.

    Wisej will call this method before loading the application allowing your app to decide whether a particular server can take the incoming session.

    Don't forget that most balancers don't support the failover feature. Refer to the load balancer's documentation.

    Healthcheck

    Most load balancers use a "healthcheck" URL to probe whether a server is available in order to update their rotation list. Wisej provides a blank URL named healthcheck.wx that simply returns the .

    When configuring your load balancer's healthcheck URL simply use your application's URL + "/healthcheck.wx".

    Heathcheck.wx is the same URL used by the offline/online automatic detection in Wisej.

    Desktop (deprecated)

    How to run a Wisej app as a standalone desktop executable.

    Wisej Desktop is deprecated and no longer supported. Use Wisej.NET Hybrid instead.

    .NET Framework

    Wisej.NET also supports a local desktop deployment (we call it Standalone deployment) as a local executable. It's very similar to the Electron system, except that we provide the shell for Internet Explorer, Chromium, Firefox and Edge.

    You can find the project source on . After downloading the extensions source code, you can compile the HostService projects. In the /bin directory you will find 4 directories (one for each browser) containing a single executable Wisej.Application.exe.

    All you need to do to deploy your Wisej app as a local app, is to copy the version of Wisej.Application.exe that you want to use along with the deployment files. The executable must be placed in the root folder, at the same level as /bin (not inside /bin).

    To determine which files to copy to the deployment folder, please follow the deployment list.

    When your Wisej application is deployed as a Standalone executable running as a desktop application, your "server side" code in .NET is running together with with the "client side" browser. This configuration gives your .NET code full access to the user's machine.

    You can:

    • Read/write the user's registry

    • Read/write the entire file system

    • Connect to a local or remote database

    • Show native windows and controls

    It is basically a local application running in the browser.

    License

    Desktop applications can be redistributed without using a server license. Technology partners can request a free by contacting [email protected].

    Add <add key="Wisej.DesktopMode" value="true"/> to web.config. Otherwise Wisej.NET will look for a server licenses instead of the free desktop license.

    Personalization

    You can customize the final executable in several ways:

    1. Each of the standalone applications is a simple WinForms project with a form and a web browser control. You can personalize it freely: i.e. add a toolbar, status bar, icon, etc.

    2. Change the initial splash loader simply by placing either a splash.png, splash.gif or splash.jpg file in the root project folder.

    3. Change the application's icon.

    IE

    Uses the Internet Explorer component that is already preinstalled with Windows. This is the smallest executable of all at roughly 500KB.

    Chromium

    Uses integrated in a WinForms application frame. The final executable is roughly 130MB since we embed the full Chromium system in the executable.

    You can update the version simply by copying the newer files over the same files included in our GitHub repository.

    Firefox

    Uses integrated in a WinForms application frame. The final executable is roughly 102MB since we embed the full Firefox system in the executable.

    You can update the version simply by copying the newer files over the same files included in our GitHub repository.

    Edge/Chromium

    Uses the latest control from Microsoft integrated integrated in a WinForms frame. The final executable is approximately 850KB but it doesn't include the deployment.

    You can update the controls simply by copying the newer files over the same files included in our GitHub repository. However, the WebView2 SDK needs to be downloaded and updated independently.

    Apache

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

    .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.

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

    NGINX

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

    .NET Core

    Wisej.NET applications targeting .NET Core can follow Microsoft's instructions for deploying an ASP.NET Core application to Linux with NGINX.

    Below you will find some useful information related to Wisej.NET-specific deployments.

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

    If HealthCheck.IsServerAvailable is null, it checks the MaxSessions, MaxMemory and MaxCPU values as configured in the application's HealthCheck.json or set by the code by assigning directly the values of the Wisej.Core.HealthCheck class.
    PollingInterval
    Application.StartPolling
    HealthCheck.IsServerAvailable
    503 Server Unavailable
    Wisej.Core.HealthCheck.Enabled
    Wisej.Core.HealthCheck.IsServerAvailable()
    HealthCheck.ReturnCode
    202 status

    Launch and control Word or any other local application

    GitHub
    IIS
    Desktop License
    CefSharp
    CefSharp
    GeckoFx
    GeckoFx
    WebView2
    WebView2 SDK
    WebView2
    CodeProject demo running as a desktop application

    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 ImageSharp.

    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.

    3. After verifying the app runs, you will need to configure the app to run on startup. 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. Click here to make a service file.

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

    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.

    .NET Framework

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

    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.

    Notice that step 1 is different from IIS because Apache never loads the actual application, instead it acts as a Reverse Proxy 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 IIS process or a Self Hosted process (may also run in a Docker container).

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

    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.

    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 sticky session functionality.

    Apache
    Linux
    MacOS
    libgdiplus

    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 ImageSharp.

    Basic Steps

    1. After generating a build using the Visual Studio Publishing Tool, 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.

    3. After verifying the app runs, you will need to configure the app to run on startup. 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. Click here to make a service file.

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

    The configuration in this book are minimal examples, use the full NGINX guide to determine how to be configure your NGINX server.

    This is all you need for NGINX to dispatch the requests to the Wisej.NET application on .NET Core.

    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.

    .NET Framework

    Deploying a Wisej application on NGINX is similar the the IIS deployment in regards to the files to copy to the production machine:

    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.

    Notice that step 1 is different from IIS because NGINX never loads the actual application, instead it acts as a Reverse Proxy dispatching requests to the web application listening on a 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 another IIS process, or a Self Hosted process (may also run in a Docker container).

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

    The configuration in this book are minimal examples, use the full NGINX guide to determine how to be configure your NGINX server.

    This is all you need for NGINX to dispatch the requests to the Wisej.NET application on .NET Framework.

    Load Balancer

    NGINX can also serve as a load balancer out of the box. Instead of setting the proxy_pass property to the actual Wisej server, assign it to an upstream configuration group that defines the load balancing rotation.

    Note that in the sample above we used "ip_hash" to bind a specific server to a client in order to achieve the required sicky session functionality. NGINX also supports "sticky" and other options.

    Linux
    MacOS
    libgdiplus

    Visual Studio Publishing

    How to publish a Wisej application using Visual Studio Publishing.

    Deploying a Wisej application can be simplified using Visual Studio Publishing. Using this approach you can deploy directly to Azure, IIS, or a directory on the file system.

    .NET Core

    Azure Publishing

    Publishing to Azure streamlines the deployment of a Wisej application to an Azure App Service Instance with minimal effort. Publishing to Azure copies all the files required for deployment to the app service.

    Basic Steps

    1. In Solution Explorer, right-click the project node and choose Publish (or use the Build > Publish menu item).

    2. If you have previously configured any publishing profiles, the Publish window appears. Select New.

    3. In the Publish window, select Azure.

    Find more information and screenshots on MSDN.

    Information about the deployment can be found in the Web Publish Activity window in Visual Studio.

    The Azure Cloud Explorer window has been retired for Visual Studio 2022.

    Web Server (IIS) Publishing

    Web Server Publishing allows a Wisej application to be rapidly distributed to a local or external IIS server.

    Basic Steps

    1. In Solution Explorer, right-click the project and choose Publish (or use the Build > Publish menu item).

    2. If you have previously configured any publishing profiles, the Publish pane appears. Select New.

    3. In the Publish window, choose Web Server (IIS).

    Find more information and screenshots on MSDN.

    If additional configuration is needed for IIS publishing, considering setting up Publish Settings.

    Folder Publishing

    Publishing to a Folder using Visual Studio exports the files needed to deploy the Wisej application to a folder on the file system. This can be used when preparing the distribution for another platform.

    Basic Steps

    1. In Solution Explorer, right-click the project and choose Publish (or use the Build > Publish menu item).

    2. If you have previously configured any publishing profiles, the Publish window appears. Select New.

    3. In the Publish window, select Folder.

    Find more information and screenshots on MSDN.

    Deploying to IIS? .

    .NET Framework

    Visual Studio Publishing does not work with SDK-Style projects targeting .NET Framework

    IIS

    How to publish a Wisej app to an IIS Server.

    .NET Core

    Deploying a Wisej .NET Core application to IIS is exactly the same as deploying any ASP.NET Core application. However, it's a bit more complex than an ASP.NET application.

    IIS Configuration

    Basic Steps

    /**
     * HealthCheck
     *
     * Place the HealthCheck.json file in the /bin directory of the
     * application to enable the enhanced load balancing features.
     *
     * Properties:
     *
     *  enabled:      Enables the enhanced load balancing healthcheck.
     *  maxMemory:    Maximum percentage of allocated memory. Default: 70; 0 = unlimited.
     *  maxSessions:  Maximum number of active sessions: Default: 0; 0 = unlimited.
     *  maxCPU:       Maximum CPU load in percentage: Default: 100; 0 = unlimited.
     *  returnCode:   Http return code to signal that this server is not available. Default: 503.
     *  retryAfter:   Value for the Retry-After header in minutes. Default: 10.
     *  returnUrl:    Url to redirect the client when the server is not available. Default: null.
     */
    {
      "enabled": false,
      "maxSessions": 0,
      "maxMemory": 70,
      "maxCPU": 100,
      "returnCode": 503,
      "retryAfter": 10,
      "returUrl": null
    }
    
    // Assign custom IsServerAvailable
    Wisej.Core.HealthCheck.IsServerAvaiable = () => 
    {
        // Add custom logic and return true (available) or false.
        return true;
    }
    
    httpd.conf
    <VirtualHost *:80>
        ServerName myapp.com
    
        <Location /myapp/>
            ProxyPass http://10.1.10.112:43662
        </Location>
    
    </VirtualHost>
    Conditional UseFileServer
    // app.UseFileServer();
    app.UseWhen(
     cx => !cx.Request.Path.Value.EndsWith(".json", StringComparison.OrdinalIgnoreCase), 
     app => app.UseFileServer()
    );
    httpd.conf
    <VirtualHost *:80>
        ServerName myapp.com
    
        <Location /myapp/>
            ProxyPass http://10.1.10.112:43662
        </Location>
    
    </VirtualHost>
    <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>
    http {
        
        server {
            listen 80;
            
            location /myapp/ {
                # Location of the Wisej server. 
                proxy_pass http://10.1.10.112:43662; 
            }
        }
    }
    Conditional UseFileServer
    // app.UseFileServer();
    app.UseWhen(
     cx => !cx.Request.Path.Value.EndsWith(".json", StringComparison.OrdinalIgnoreCase), 
     app => app.UseFileServer()
    );
    http {
        
        server {
            listen 80;
            
            location /myapp/ {
                # Location of the Wisej server. 
                proxy_pass http://10.1.10.112:43662; 
            }
        }
    }
    http {
        
        upstream myapp1 {
            ip_hash;
            server 10.1.10.1:52433;
            server 10.1.10.1:52434;
            server 10.1.10.2:52000;
            server 10.1.10.2:52001;
        }
        
        server {
            listen 80;
            
            location /myapp/ {
                # Location of the Wisej server. 
                proxy_pass http://myapp1; 
            }
        }
    }

    Select Azure App Service (Windows) and Next.

  • Sign in with your Azure account, if necessary. Select Create a new Azure App Service...

  • In the Create Azure App Service (Windows) dialog, the App Name, Resource Group, and App Service Plan entry fields are populated. You can keep these names or change them. When ready, select Create.

  • In the Publish dialog, the newly created instance has been automatically selected. When ready, select Finish.

  • Select Publish. Visual Studio deploys the app to your Azure App Service, and the web app loads in your browser. The project properties Publish pane shows the site URL and other details.

  • Choose Web Deploy as the deployment method. Web Deploy simplifies deployment of Web applications and Web sites to IIS servers, and must be installed as an application on the server. Use the Web platform installer to install it.

  • Configure the required settings for the publish method and select Finish.

  • To publish, select Publish in the summary page. The Output window shows deployment progress and results.

  • Enter a path or select Browse to specify a folder.

  • Click Finish.

  • Select Publish. Visual Studio builds the project and publishes it to the specified folder.

  • To configure deployment settings, select Edit in the publish profile summary and select the Settings tab.

    • The settings you see depend on your application type.

  • Configure options such as whether to deploy a Debug or Release configuration, and then select Save.

  • To republish, select Publish.

  • Click here to learn about alternatives for managing deployed Azure Resources.
    Click here to learn more about Wisej IIS setup

    Install IIS .NET Core Hosting Bundle for your deployment framework.

  • Create an application in IIS.

  • Uncomment and update the IIS entries in web.config.

  • Publish the application to a folder using the Visual Studio publishing tool.

  • Create a virtual application in IIS pointing to the published folder.

  • Create a new App Domain set to Unmanaged Code and assign it to the application.

  • Our templates have already added the commented out IIS configuration to the web.config file:

    However, the web.config in the project has the processPath set to the debug output. When using the publishing tool, it changes the process path to ".\WisejWebPageApplication1.dll" or ".\WisejWebPageApplication1.exe" depending on the hosting model.

    InProcess

    When running InProcess, IIS uses the AspNetCoreModuleV2 handler to load your ASP.NET Core app in the app domain's process and directly invokes the OWIN middleware.

    OutOfProcess

    When running OutOfProcess, IIS starts your ASP.NET Core application as a standalone executable and acts as a reverse proxy, just like NGINX and Apache.

    Configuration File

    Everything else in web.config is unchanged. You can set the debug mode, the license key and theme exactly like you did in Wisej 2.x.

    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.

    .NET Framework

    Deploying a Wisej 2.x and 3.x .NET 4.8 application to IIS is exactly the same as deploying any ASP.NET application. It's just a matter of copying the right files and configuring IIS to recognize the application folder as a web application.

    Basic Steps

    1. Create an application in IIS

    2. Create the /bin directory in the application's directory

    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.

    References:

    Configuration file

    If you are deploying a child IIS application, remember that IIS inherits the web.config from the parent application. When the parent application is also a Wisej application, you will get a server error because of duplicate settings in web.config.

    There are two solutions:

    1. Remove the duplicated setting in the child web.config

    2. Add XML statements to remove the duplicated settings in the child web.config.

    Names are case sensitive.

    Debug Mode

    When deploying in production, we recommend to turn off the debug flag in web.config.

    When debug mode is false all the .js and .css resources are minified and the debug console in the browser receives much less logging data then debug mode.

    License Key

    Copy your deployment Wisej Server key to web.config in the Wisej.LicenseKey setting. Make sure the server has internet connection in order to activate the license.

    App Pool & Permissions

    When you create a new application in IIS, it will be assigned to the DefaultAppPool which uses the ApplicationPoolIdentify as the user. This is fine in most deployments.

    If you want to create a new Application Pool it's also fine. The only aspect of the application pool that affects Wisej is the user and the user's permissions: it must have Full Control on the system's Temp directory (which is usually located at C:\Windows\Temp).

    Assigning Full Control for the system's Temp directory is required for the application to start; otherwise you will see the "Access Denied" exception on startup.

    There are several settings on the Application Pool that you may also want to look at depending on your deployment requirements. Please refer to Microsoft's documentation for more information.

    If you need additional professional support, please contact us.

    Application Request Routing (AAR)

    IIS can also function as a simple load balancer when the AAR module is installed. Please refer to Microsoft's documentation to learn about this feature.

    IIS Configuration in Windows Features

    Self Hosted

    How to run a Wisej app as a self-hosted process or service.

    .NET Core

    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.

    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 .

    Basic Steps

    1. Run the to deploy to a folder.

    That's it. When you run YourApplication.exe you can use the --urls command line argument to .

    Service

    Wisej 3 ASP.NET Core apps can be deployed as a quite easily:

    1. Add the nuget to your project.

    2. Add builder.Host.UseWindowsServices() to Startup.cs or Startup.vb (see code snippet below).

    3. Register the service using ""

    4. Now you can start the service like any other Windows service. For any additional configuration option refer to the Microsoft documentation.

    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.

    .NET Framework

    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 executable in the root folder of the deployment directory.

    Basic Steps

    1. Create the application directory

    2. Copy Wisej.HostService.exe to the application directory

    3. Create the /bin directory in the application's directory

    4. Copy all the assemblies from your local /bin to the server's

    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 section below to see what to add.

    These are the supported startup arguments:

    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:

    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.

    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.

    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.

    Once the web.config file includes these settings it can be used with IIS, self hosting, standalone, and Ultidev/Cassini deployments.

    <handlers>
    	<!--
    	Uncomment the aspNetCore handler below to deploy to IIS when using .NET Core.
    	-->
    	<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
    	<add name="json" verb="*" path="*.json" type="System.Web.HttpForbiddenHandler" />
    	<add name="wisej" verb="*" path="*.wx" type="Wisej.Core.HttpHandler, Wisej.Framework"/>
    </handlers>
    
    <!--
    Uncomment the aspNetCore section below to deploy to IIS when using .NET Core.
    -->
    <aspNetCore stdoutLogEnabled="false" hostingModel="InProcess" processPath="bin\Debug\net6.0\WisejWebPageApplication1.exe" arguments="" />
    
    Conditional UseFileServer
    // app.UseFileServer();
    app.UseWhen(
     cx => !cx.Request.Path.Value.EndsWith(".json", StringComparison.OrdinalIgnoreCase), 
     app => app.UseFileServer()
    );
    <modules>
          <remove name="Wisej"/>
          <add name="Wisej" type="Wisej.Core.HttpModule, Wisej.Framework"/>
    </modules>
    
    ...
    
    <handlers>
      <remove name="json"/>
      <remove name="wisejn"/>
      <add name="json" verb="*" path="*.json" type="System.Web.HttpForbiddenHandler" />
      <add name="wisej" verb="*" path="*.wx" type="Wisej.Core.HttpHandler, Wisej.Framework"/>
    </handlers>
    <configuration>
      <appSettings>
        <add key="Wisej.LicenseKey" value=""/>
        <add key="Wisej.DefaultTheme" value="Blue-1"/>
      </appSettings> 
      <system.web>
        <compilation debug="true|false" />
    /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.

  • Changes the name of the service, otherwise Wisej sets the name to “Wisej.HostService: “ + {Name of Wisej Application Folder}

    (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.

    ImageSharp
    publishing tool
    configure the application's endpoints
    Windows service
    WindowsServices
    sc create
    Wisej.HostService
    web.config

    -n:{name} or -name:{name}

    var builder = WebApplication.CreateBuilder(new WebApplicationOptions
    {
      Args = args,
      WebRootPath = "./",
    
        // Add this:
      ContentRootPath = WindowsServiceHelpers.IsWindowsService() ? AppContext.BaseDirectory : default
    });
    
    // And this
    builder.Host.UseWindowsService();
    
    ...
    ' Add UseWindowsService() and UseContentRoot like shown below
    Host.CreateDefaultBuilder(args).UseWindowsService().ConfigureWebHostDefaults(
        Sub(builder)
            builder.UseWebRoot("./")
            builder.UseStartup(Of Startup)()
            builder.UseContentRoot(If(WindowsServiceHelpers.IsWindowsService(), AppContext.BaseDirectory, Nothing))
        End Sub).Build().Run()
    
    Conditional UseFileServer
    // app.UseFileServer();
    app.UseWhen(
     cx => !cx.Request.Path.Value.EndsWith(".json", StringComparison.OrdinalIgnoreCase), 
     app => app.UseFileServer()
    );
    >Wisej.HostService -i -p:8181
    >Wisej.HostService -i -p:8181
    >Wisej.HostService -i -p:8182
    >Wisej.HostService -i -p:8183
    >Wisej.HostService -d:localhost
    <configuration>
    ...
      <system.web>
        <compilation debug="false" />
        <httpRuntime targetFramework="4.8" maxRequestLength="1048576"/>
        <httpModules>
          <add name="Wisej" type="Wisej.Core.HttpModule, Wisej.Framework"/>
        </httpModules>
      </system.web>
    ...
      <system.webServer>
        <validation validateIntegratedModeConfiguration="false"/>
    ...
    Remote debugging - Visual Studio (Windows)MicrosoftLearn
    Introduction | Wisej.NET Hybriddocs.wisej.com
    Logo
    Logo
    Host ASP.NET Core on Linux with NginxMicrosoftLearn
    Quickstart: Deploy an ASP.NET web app - Azure App ServiceMicrosoftLearn
    Visual Studio Publishing | Wisej.NET Deploymentdocs.wisej.com
    Generate a build with Visual Studio Publishing
    mod_proxy_balancer - Apache HTTP Server Version 2.4httpd.apache.org
    Apache Load Balancer Setup
    Logo
    Logo
    Reverse Proxy Guide - Apache HTTP Server Version 2.4httpd.apache.org
    Apache Reverse Proxy Setup
    Reverse Proxy Guide - Apache HTTP Server Version 2.4httpd.apache.org
    Apache Reverse Proxy Setup
    Logo
    HTTP Load Balancingnginx
    NGING Load Balancing Setup
    NGINX Reverse Proxynginx
    NGINX Reverse Proxy Setup
    NGINX Reverse Proxynginx
    NGINX Reverse Proxy Setup
    Publish an ASP.NET web app - Visual Studio (Windows)MicrosoftLearn
    Folder Publishing
    Logo
    Logo
    Logo
    Publish to IIS by importing publish settings - Visual Studio (Windows)MicrosoftLearn
    Publish Settings Setup & Configuration
    Logo
    Logo
    Publish an ASP.NET web app - Visual Studio (Windows)MicrosoftLearn
    Azure App Service Publishing
    Logo
    Publish an ASP.NET web app - Visual Studio (Windows)MicrosoftLearn
    Website Publishing
    Logo
    Logo
    Logo
    Logo
    Application for a Site &lt;application&gt;MicrosoftLearn
    Logo
    Deploy a Traditional ASP.NET Application to Elastic Beanstalk - AWS Toolkit with Amazon QAWS Toolkit with Amazon Q
    Logo
    Deploying a .NET 6 Wisej.NET App to IIS