Deploying
Deploy Portway as an IIS website on Windows Server with HTTPS and a dedicated Application Pool.
For Docker-based deployment, see Docker Installation.
INFO
This guide assumes working knowledge of IIS and your network/data sources. The steps cover the required configuration, some details 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:
$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
- Open IIS Manager
- Create an Application Pool:
- Name:
PortwayAppPool - .NET CLR version:
No Managed Code - Pipeline mode:
Integrated - Start Mode:
AlwaysRunning - Idle Time-out:
0
- Name:
- Create a new Website:
- Application pool:
PortwayAppPool - Physical path:
C:\Apps\Portway - HTTPS binding with your certificate
- Application pool:
- 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, returnsAlivehttps://localhost/docs, OpenAPI documentation interface
Initial configuration
Retrieve the access token
Find the generated token at tokens/[SERVERNAME].txt:
{
"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:
{
"Environment": {
"ServerName": "YOUR_SERVER",
"AllowedEnvironments": ["prod", "dev", "test"]
}
}Create environments/{name}/settings.json for each environment:
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:
<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.dbfor authentication databasetokens/for token filesenvironments/for connection strings and settingsendpoints/for endpoint definitions
For upgrades, see Upgrading Portway.