51 lines
2.1 KiB
Batchfile
51 lines
2.1 KiB
Batchfile
@echo off
|
|
REM Unlock IIS Handlers Section for iisnode
|
|
REM Run as Administrator
|
|
|
|
echo ========================================
|
|
echo UNLOCK IIS HANDLERS SECTION
|
|
echo ========================================
|
|
echo.
|
|
|
|
REM Check if running as Administrator
|
|
net session >nul 2>&1
|
|
if %errorLevel% neq 0 (
|
|
echo [ERROR] This script must be run as Administrator!
|
|
echo Please right-click and select "Run as administrator"
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
echo [1/3] Checking iisnode installation...
|
|
where iisnode >nul 2>&1
|
|
if %errorLevel% neq 0 (
|
|
echo [WARNING] iisnode command not found in PATH
|
|
echo [INFO] This is normal - checking IIS module instead...
|
|
)
|
|
|
|
echo [2/3] Unlocking handlers section in IIS...
|
|
powershell -Command "$ErrorActionPreference = 'Stop'; Import-Module WebAdministration; $configPath = 'MACHINE/WEBROOT/APPHOST'; $section = 'system.webServer/handlers'; try { Set-WebConfigurationProperty -PSPath $configPath -Filter $section -Name 'overrideMode' -Value 'Allow' -ErrorAction Stop; Write-Host '[OK] Handlers section unlocked successfully' } catch { Write-Host '[ERROR] Failed to unlock handlers section:' ; Write-Host $_.Exception.Message }"
|
|
|
|
echo.
|
|
echo [3/3] Verifying unlock...
|
|
powershell -Command "$ErrorActionPreference = 'Stop'; Import-Module WebAdministration; $configPath = 'MACHINE/WEBROOT/APPHOST'; $section = 'system.webServer/handlers'; try { $overrideMode = (Get-WebConfigurationProperty -PSPath $configPath -Filter $section -Name 'overrideMode').Value; if ($overrideMode -eq 'Allow') { Write-Host '[OK] Handlers section is unlocked (Allow)' } else { Write-Host '[WARNING] Handlers section overrideMode:' $overrideMode } } catch { Write-Host '[INFO] Could not verify - may need manual unlock' }"
|
|
|
|
echo.
|
|
echo ========================================
|
|
echo UNLOCK COMPLETE!
|
|
echo ========================================
|
|
echo.
|
|
echo Next Steps:
|
|
echo 1. Restart IIS: iisreset
|
|
echo 2. Refresh browser: http://localhost
|
|
echo.
|
|
echo If error persists, manually unlock in IIS Manager:
|
|
echo - Open IIS Manager
|
|
echo - Select server (root)
|
|
echo - Double-click "Feature Delegation"
|
|
echo - Find "Handler Mappings"
|
|
echo - Set to "Read/Write"
|
|
echo.
|
|
pause
|
|
|