On this page

Deploying

This guide walks you through deploying Portway on Windows Server behind IIS, from prerequisites to a running gateway with a backup routine. If you're deploying with containers instead, Docker Installation covers that path.

The steps assume working knowledge of IIS and your network and data sources; the essentials are all here, though some details will depend on your existing environment.

Prerequisites

  • Windows Server with IIS installed and running
  • Administrator access
  • ASP.NET Core 10 Hosting Bundle
  • A TLS/SSL certificate (self-signed is acceptable for internal deployments)

WARNING

Download the Hosting Bundle, not the x64 runtime installer. The Hosting Bundle includes the IIS integration module the runtime package omits. Restart IIS after installation (iisreset).

Installation

1. Generate the encryption key

Set the encryption key as a Machine-level environment variable before deploying the application files:

powershell
$bytes = New-Object byte[] 48
[Security.Cryptography.RandomNumberGenerator]::Create().GetBytes($bytes)
[Environment]::SetEnvironmentVariable("PORTWAY_ENCRYPTION_KEY", [Convert]::ToBase64String($bytes), "Machine")

2. Deploy application files

Extract the Portway release to your target directory (e.g. C:\Apps\Portway).

3. Configure IIS

  1. Open IIS Manager
  2. Create an Application Pool:
    • Name: PortwayAppPool
    • .NET CLR version: No Managed Code
    • Pipeline mode: Integrated
    • Start Mode: AlwaysRunning
    • Idle Time-out: 0
  3. Create a new Website:
    • Application pool: PortwayAppPool
    • Physical path: C:\Apps\Portway
    • HTTPS binding with your certificate
  4. Set directory permissions:
    cmd
    icacls "C:\Apps\Portway" /grant "IIS AppPool\PortwayAppPool:(OI)(CI)M" /T

INFO

If any proxy endpoint needs NTLM pass-through (e.g. for Exact Globe+ or AFAS Profit), bind the Application Pool identity to a domain user with the required network access instead of using ApplicationPoolIdentity.

4. Start and verify

Start the website. On first run, Portway creates tokens/, log/, and auth.db automatically.

Verify the application is running:

  • https://localhost/health/live, returns Alive
  • https://localhost/docs, OpenAPI documentation interface

Initial configuration

Retrieve the access token

Find the generated token at tokens/[SERVERNAME].txt:

json
{
  "Username": "SERVER-NAME",
  "Token": "your-bearer-token-here",
  "AllowedScopes": "*",
  "AllowedEnvironments": "*"
}

WARNING

Remove this file from disk immediately after recording the token. The token is a plaintext secret. Unauthorized access to this file compromises your gateway.

Configure environments

Edit environments/settings.json:

json
{
  "Environment": {
    "ServerName": "YOUR_SERVER",
    "AllowedEnvironments": ["prod", "dev", "test"]
  }
}

Create environments/{name}/settings.json for each environment:

json
{
  "ServerName": "YOUR_SQL_SERVER",
  "ConnectionString": "Server=YOUR_SQL_SERVER;Database=prod;Trusted_Connection=True;TrustServerCertificate=true;"
}
json
{
  "ServerName": "YOUR_SQL_SERVER",
  "ConnectionString": "Server=YOUR_SQL_SERVER;Database=dev;Trusted_Connection=True;TrustServerCertificate=true;"
}

Troubleshooting

Error Likely cause Resolution
HTTP 500.19 ASP.NET Core Module not installed Reinstall the Hosting Bundle and run iisreset
HTTP 500 Application startup error Check log/portwayapi-*.log and Windows Event Viewer
HTTP 403 Directory permissions Run icacls to grant the Application Pool identity access
Blank screen No HTTPS binding or missing certificate Bind a certificate to the site in IIS Manager
Database errors Invalid connection string Verify the connection string and SQL Server network access

Enable stdout logging in web.config for startup errors that do not reach the application log:

xml
<aspNetCore stdoutLogEnabled="true" stdoutLogFile=".\log\stdout" />

Log locations:

  • Application log: log/portwayapi-*.log
  • IIS log: C:\inetpub\logs\LogFiles\W3SVC[ID]\
  • Startup errors: Windows Event Viewer → Application

Security configuration

  • Enforce HTTPS using URL Rewrite rules (IIS Rewrite Module)
  • Restrict tokens/ directory read access to the application pool identity only
  • Configure IP whitelisting in IIS Manager (IP Address and Domain Restrictions)
  • Use a dedicated domain service account with minimum SQL permissions for proxy endpoints

See Security for the full security configuration reference.

Backup

Include these in your backup plan:

  • auth.db for authentication database
  • tokens/ for token files
  • environments/ for connection strings and settings
  • endpoints/ for endpoint definitions

For upgrades, see Upgrading Portway.

Next steps

Last updated: 2026-07-23