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

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

  2. Create an application in IIS.

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

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

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

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

<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="" />

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.

.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 the /bin directory in the application's directory

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

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

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

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

  6. Copy Web.config

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

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

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

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

Names are case sensitive.

Debug Mode

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

<configuration>
  <appSettings>
    <add key="Wisej.LicenseKey" value=""/>
    <add key="Wisej.DefaultTheme" value="Blue-1"/>
  </appSettings> 
  <system.web>
    <compilation debug="true|false" />

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.

You may also use a pre-activated license by copying the wisej-server.lic file that was generated on the server that activated it. It must be placed in the root folder of the deployed project.

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.

Last updated