Windows IIS Agent
The Treblle IIS Agent is a native C++ module for Windows Server 2022 / 2025 that passively monitors JSON API traffic and sends data to Treblle. It hooks into the IIS request pipeline via a DLL, giving you full API observability with zero impact on availability or latency.
IIS Worker Process (w3wp.exe)
└── TreblleAgent.dll
├── OnBeginRequest → route check → capture request headers + body
├── OnSendResponse → capture response headers + body chunks
└── OnEndRequest → build JSON payload → push to background queue
│
└── Background thread
└── WinHTTP HTTPS POST → ingress.treblle.comNote
The IIS request thread only pushes a string to an in-memory queue. All network I/O happens on a dedicated background thread, so Treblle never blocks your API.
Prerequisites
| Requirement | Version |
|---|---|
| Windows Server | 2022 or 2025 |
| IIS | 10.0 |
| Architecture | x64 only |
| Privileges | Local Administrator (install only) |
You will also need a Treblle account with an API Key and SDK Token.
Security
Code signing
Every TreblleAgent.dll on the Releases page is digitally signed (Authenticode) with a Sectigo OV code signing certificate issued to Treblle. OV means Sectigo verified Treblle as a real, registered company before issuing it. The signature is also timestamped, so it stays valid even after the certificate itself expires.
The practical benefit: Windows and your security tools can see exactly who published the DLL, so it is treated as software from a known company rather than an unknown file. That usually means fewer security exceptions for your team to request before the agent can run:
- Antivirus and EDR (endpoint detection and response) - signed binaries rarely trigger the false positives that unsigned native DLLs do, so you typically do not need a per-file allowlist entry
- AppLocker and WDAC (Windows Defender Application Control) - you can allow the agent with a publisher rule for Treblle, which keeps working across updates, instead of a file hash rule that has to be updated every time the DLL changes
- SmartScreen - a signed file from a known publisher is not flagged as an app from an unrecognized publisher
You do not have to do anything with the signature. Windows and your security tools check it automatically. If you or your security team want to see it for yourselves, this is optional but easy:
Get-AuthenticodeSignature -FilePath "TreblleAgent.dll" | Format-List Status, StatusMessage, SignerCertificate, TimeStamperCertificateStatus should come back as Valid, and the signer certificate should be issued to Treblle. If you have the Windows SDK installed, signtool shows the same result plus the full certificate chain:
signtool verify /pa /v "TreblleAgent.dll"Caution
If you check and Status is anything other than Valid (for example NotSigned or HashMismatch), the file may have been altered after Treblle published it. Download it again from the official Releases page before installing.
Installation
Step 1 - Download the agent
From the Releases page , download two things:
TreblleAgent.dll- the agent itself, code-signed by Treblle- The installer package, which contains the
installer\folder withinstall.ps1anduninstall.ps1
Put TreblleAgent.dll inside the installer\ folder so both sit next to each other.
Caution
Windows marks any file downloaded from the internet as blocked - signed or not - and IIS may refuse to load a blocked DLL. Unblock it before running the installer:
Unblock-File -Path "TreblleAgent.dll"Alternatively: right-click the file → Properties → tick Unblock → OK.
Tip
If you want to confirm the DLL really comes from Treblle before installing it, see Code signing above. This is optional.
Step 2 - Run the installer
Open PowerShell as Administrator, go to the installer\ folder, and run the install script:
# Right-click PowerShell → Run as Administrator
cd path\to\installer
.\install.ps1Note
If PowerShell refuses to run with “running scripts is disabled on this system”, allow scripts for the current session and retry:
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process
.\install.ps1The -Scope Process flag applies only to the current window and reverts when the session closes.
The installer will:
- Copy
TreblleAgent.dlltoC:\iismodules\treblle\ - Prompt you for your API Key, SDK Token, and optional exclusion patterns
- Write
C:\iismodules\treblle\treblle.config - Register the agent globally in IIS, so it applies to every site on the server
- Restart IIS
Step 3 - Grant app-pool permissions (if needed)
On some servers, the new C:\iismodules\treblle\ folder does not inherit permissions for the accounts IIS worker processes run as, so IIS cannot read the DLL and fails to load it. If IIS does not start after installation, give those accounts read and execute access:
# Covers every application pool via the built-in IIS_IUSRS group (recommended)
icacls "C:\iismodules\treblle" /grant "IIS_IUSRS:(OI)(CI)RX" /T
# Alternative - grant a single named application pool only
icacls "C:\iismodules\treblle" /grant "IIS AppPool\DefaultAppPool:(OI)(CI)RX" /TReplace DefaultAppPool with the name of your app pool. To list all pools:
%windir%\system32\inetsrv\appcmd.exe list apppoolThen restart IIS:
iisresetStep 4 - Verify
List the registered IIS modules and look for TreblleAgent:
%windir%\system32\inetsrv\appcmd.exe list module
# Should include:
# MODULE "TreblleAgent" (image:C:\iismodules\treblle\TreblleAgent.dll)Make a request to one of your API endpoints and check your Treblle dashboard .
Configuration
The config file lives at C:\iismodules\treblle\treblle.config. Edits take effect immediately - the agent notices the file has changed and reloads it on the next request, so there is no need to restart IIS.
{
"api_key": "YOUR_TREBLLE_API_KEY",
"sdk_token": "YOUR_TREBLLE_SDK_TOKEN",
"treblle_url": "https://ingress.treblle.com",
"debug": false,
"disabled": false,
"exclude_routes": [
{ "host": "internal.yourdomain.com" },
{ "host": "api.yourdomain.com", "path": "/health" },
{ "host": "api.yourdomain.com", "path": "/metrics" }
],
"masked_keywords": [
"password", "pwd", "secret",
"password_confirmation", "passwordConfirmation",
"cc", "card_number", "cardNumber", "ccv",
"credit_score", "creditScore", "ssn"
]
}Configuration reference
Field
Type, Default and Description
api_key
string - Required. Your Treblle API key.
sdk_token
string - Required. Your Treblle SDK token.
treblle_url
string - Default: https://ingress.treblle.com. Override only if directed by Treblle support.
debug
bool - Default: false. When true, errors are written to the Windows Application Event Log (source: Treblle). Leave false in production.
disabled
bool - Default: false. When true, the agent stops monitoring entirely. Takes effect immediately.
exclude_routes
array - Default: []. List of route objects to exclude from monitoring. Empty means all JSON API traffic is monitored.
masked_keywords
array - List of field names whose values are redacted before sending to Treblle. Omit to use built-in defaults. Set to [] to disable masking.
Each object in exclude_routes:
Field
Required and Description
host
string - Required. Hostname to exclude (case-insensitive). Must match the HTTP Host header, excluding port.
path
string - Optional. URL path prefix to exclude (case-insensitive). If omitted, the entire host is excluded.
Excluding routes
The agent monitors all JSON API traffic by default. A request is excluded only when its Host header matches an entry’s host field, and its URL path starts with the entry’s path prefix (if specified). All non-JSON responses (HTML, CSS, JS, images) are automatically ignored - no configuration needed.
The snippets below are example entries for the exclude_routes array in your config file. The // comments are only there to explain each one - leave them out of the real file.
// Exclude an entire internal host
{ "host": "internal.yourdomain.com" }
// Exclude health and metrics endpoints on a specific host
{ "host": "api.yourdomain.com", "path": "/health" },
{ "host": "api.yourdomain.com", "path": "/metrics" }
// Exclude a legacy API version
{ "host": "api.yourdomain.com", "path": "/v1" }Sensitive data masking
The agent redacts field values matching masked_keywords before any data leaves the server. Masking applies to request bodies, response bodies, request headers, and response headers. Each character of a matched value is replaced with * so the length is preserved.
The following fields are masked by default when masked_keywords is omitted:
password, pwd, secret, password_confirmation, passwordConfirmation, cc, card_number, cardNumber, ccv, credit_score, creditScore, ssn
To add custom keywords, specify your full list (it replaces the defaults entirely):
"masked_keywords": [
"password", "pwd", "secret",
"password_confirmation", "passwordConfirmation",
"cc", "card_number", "cardNumber", "ccv",
"credit_score", "creditScore", "ssn",
"api_token", "access_token", "private_key"
]Updating the agent
Download the new TreblleAgent.dll from the Releases page, put it in the installer\ folder, and run the install script again - it handles re-registration automatically:
.\install.ps1To update manually, stop IIS, replace the DLL with the newly downloaded one, then start IIS again:
iisreset /stop
Copy-Item path\to\new\TreblleAgent.dll C:\iismodules\treblle\TreblleAgent.dll
iisreset /startUninstalling
.\uninstall.ps1This unregisters the agent from IIS and asks whether you also want to delete C:\iismodules\treblle\, which contains your treblle.config.
Debug mode
Set "debug": true in treblle.config to write errors to the Windows Application Event Log under source Treblle. Open Event Viewer → Windows Logs → Application and filter by source Treblle.
Common log entries:
| Entry | Cause |
|---|---|
WinHttpCrackUrl failed for URL: ... | Check treblle_url format |
WinHttpSendRequest failed (0x...) | Network connectivity issue |
ingress returned HTTP 401 | Check api_key and sdk_token |
Caution
Always set debug back to false in production - Event Log writes have a small overhead.
Troubleshooting
Agent doesn’t appear in appcmd list module
- Confirm you ran the installer as Administrator
- Look in Event Viewer → Windows Logs → System for IIS startup errors
- Confirm you downloaded the x64 release DLL (the agent does not run on x86)
Agent is registered but no data appears in Treblle
- Confirm the API returns
Content-Type: application/jsonin the response - Check that the host/path is not matched by an
exclude_routesentry - Enable
"debug": trueand check the Application Event Log - Verify network access from the server to
ingress.treblle.com:443
IIS fails to start after installing the agent
- Confirm the DLL path in
C:\Windows\System32\inetsrv\config\applicationHost.configmatches the actual file location - Temporarily rename
TreblleAgent.dlland restart IIS to confirm it is the cause - Grant app-pool read permissions as described in Step 3 above
Request bodies are empty in Treblle
- Confirm the request includes
Content-Type: application/json - Bodies larger than 2 MB are intentionally not captured
Tip
For more details and source code, see the treblle-iis GitHub repository .