This repository includes a Windows IIS ISAPI sample that proves iccIisIsapi.dll
can load IccProfLib2.dll and IccXML2.dll inside an IIS worker process.
After the handler is mapped, the extension responds to four request forms:
GET /iccIisIsapi.dll?mode=health- returns plain text
ok
- returns plain text
GET /iccIisIsapi.dll- returns plain text with:
IccProfLibversionIccLibXMLversion- profile spec version
- generated XML byte count
- returns plain text with:
GET /iccIisIsapi.dll?format=xml- returns a minimal ICC XML payload with
Content-Type: application/xml
- returns a minimal ICC XML payload with
POST /iccIisIsapi.dll?mode=tools&input=iccorPOST /iccIisIsapi.dll?mode=tools&input=xml- runs
iccToXml,iccFromXml,iccDumpProfile, andiccRoundTrip - returns JSON with exit codes, console output, generated artifact previews, and direct HTTP links for the uploaded input, logs, and generated files
- runs
Example local URLs from the current IIS sample site:
http://localhost:18081/
http://localhost:18081/endpoints.html
http://localhost:18081/iccIisIsapi.dll
http://localhost:18081/iccIisIsapi.dll?mode=health
http://localhost:18081/iccIisIsapi.dll?format=xml
403.14 at the site root means IIS is serving a directory path, directory
browsing is disabled, and there is no default document to open.
For this sample, the fix is not to enable directory browsing. The better fix is:
- Keep the site root pointed at the deployed
binfolder. - Put an
index.htmlfile in that folder. - Put a
web.configfile in that folder that enablesindex.htmlas the default document. - Keep the ISAPI handler mapped to
iccIisIsapi.dll.
This repository now installs index.html and web.config next to
iccIisIsapi.dll, so the root URL serves a landing page instead of the IIS
directory-listing error. Per-request uploads and generated files are written
under _tool-work and left accessible over HTTP so they can be fetched back
directly. The same web.config adds .icc and .icm MIME mappings so raw ICC
profiles download as application/octet-stream instead of failing with
404.3 - Not Found.
The sample install directory should contain at least:
iccIisIsapi.dllIccProfLib2.dll(orIccProfLib2d.dllfor Debug)IccXML2.dll(orIccXML2d.dllfor Debug)iconv-2.dlllibxml2.dllzlib1.dll(orzlibd1.dllfor Debug)index.html,index2.html,endpoints.html,integration.htmlsite.css,site.js,sanitize.jsweb.configassets/-- ICC branding images_tool-work/index.html-- workspace landing page- Tool executables:
iccToXml.exe,iccFromXml.exe,iccDumpProfile.exe,iccRoundTrip.exe - JSON tool executables (optional, if IccJSON is built):
iccToJson.exe,iccFromJson.exe - JSON support DLL (optional):
IccJSON2.dll(orIccJSON2d.dllfor Debug)
If the transitive runtime DLLs are missing, the IIS worker process can fail to load the extension even when the handler mapping is correct.
- Enable the IIS ISAPI extension feature.
dism /online /Enable-Feature /FeatureName:IIS-ISAPIExtensions /All /NoRestart- Build and install the sample.
if (-not $env:VCPKG_ROOT) {
throw "Set VCPKG_ROOT to your vcpkg checkout first."
}
$prefix = Join-Path (Resolve-Path .) 'out\iis-shared-install'
$toolchain = Join-Path $env:VCPKG_ROOT 'scripts\buildsystems\vcpkg.cmake'
cmake -S Build\Cmake -B out\iis-shared-vcpkg-toolchain `
-G "Visual Studio 17 2022" `
-A x64 `
"-DCMAKE_TOOLCHAIN_FILE=$toolchain" `
"-DCMAKE_INSTALL_PREFIX=$prefix" `
-DVCPKG_TARGET_TRIPLET=x64-windows `
-DENABLE_TESTS=OFF `
-DENABLE_TOOLS=ON `
-DENABLE_WXWIDGETS=OFF `
-DENABLE_SHARED_LIBS=ON `
-DENABLE_STATIC_LIBS=ON `
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF `
-Wno-dev
cmake --build out\iis-shared-vcpkg-toolchain --config Release `
--target iccIisIsapi iccIisIsapiSmoke -- /m /maxcpucount
cmake --install out\iis-shared-vcpkg-toolchain --config Release- Point an IIS site at the installed
bindirectory.
<repo>\out\iis-shared-install\bin
-
Use an x64 app pool if the sample was built for x64.
-
Create or update the IIS site with the helper script in the sample source directory. The script configures the app pool, site root, handler mapping, ISAPI restriction entry, and verification probes automatically.
.\Tools\Winnt\IccIisIsapi\Install-IccIisIsapiSite.ps1 `
-SiteName "iccDLL Server" `
-Port 18081The script defaults -SiteRoot to <repo>\out\iis-shared-install\bin. Use
-SiteRoot to point IIS at a different install bundle, or -Layout Build with
-Configuration Release for a build-tree proof.
Direct endpoint checks:
curl.exe http://localhost:18081/iccIisIsapi.dll?mode=health
curl.exe http://localhost:18081/iccIisIsapi.dll
curl.exe http://localhost:18081/iccIisIsapi.dll?format=xml
curl.exe -H "Accept: application/json" -H "Content-Type: application/octet-stream" `
--data-binary "@sample.icc" `
"http://localhost:18081/iccIisIsapi.dll?mode=tools&input=icc&filename=sample.icc"Browser checks:
- Open
http://localhost:18081/ - Confirm the landing page loads instead of
HTTP Error 403.14 - Forbidden - Open
http://localhost:18081/endpoints.htmland upload an ICC profile or XML file - Open the returned
_tool-work/<job>/workspace link to fetch the original upload, logs, and generated artifacts directly over HTTP
The build target also copies index.html and web.config next to the built
DLL in the build output directory, so you can point IIS at the build tree for a
fast local proof before installing.
$buildOut = (Resolve-Path '.\out\iis-shared-vcpkg-toolchain\Tools\IccIisIsapi\Release').Path
$oldPath = $env:PATH
try {
$env:PATH = "$buildOut;$oldPath"
& "$buildOut\iccIisIsapiSmoke.exe" "$buildOut\iccIisIsapi.dll"
}
finally {
$env:PATH = $oldPath
}Build/Cmake/Tools/IccIisIsapi/CMakeLists.txtTools/Winnt/IccIisIsapi/iccIisIsapi.cpp-- ISAPI DLL entry pointTools/Winnt/IccIisIsapi/IccIsapiSanitize.h/.cpp-- Sanitization primitives (CWE-79, CWE-116, CWE-170, CWE-20)Tools/Winnt/IccIisIsapi/IccIsapiHttp.h/.cpp-- HTTP response helpers with security headersTools/Winnt/IccIisIsapi/sanitize.js-- Client-side DOM-XSS preventionTools/Winnt/IccIisIsapi/IccIsapiFuzzTest.cpp-- Fuzz test harnessTools/Winnt/IccIisIsapi/Stress-IccIisIsapi.ps1-- 10-phase concurrent stress testTools/Winnt/IccIisIsapi/Install-IccIisIsapiSite.ps1-- IIS site installerTools/Winnt/IccIisIsapi/Uninstall-IccIisIsapiSite.ps1-- IIS site uninstallerTools/Winnt/IccIisIsapi/Export-IccIisIsapiSite.ps1-- Package site for deploymentTools/Winnt/IccIisIsapi/Import-IccIisIsapiSite.ps1-- Deploy package to IISTools/Winnt/IccIisIsapi/index.html-- Landing pageTools/Winnt/IccIisIsapi/endpoints.html-- Browser tool consoleTools/Winnt/IccIisIsapi/web.config-- IIS configurationTools/Winnt/IccIisIsapi/api.md-- HTTP API referenceTools/Winnt/IccIisIsapi/iis-isapi.openapi.yaml-- OpenAPI 3.1 spec