97 lines
2.4 KiB
Batchfile
97 lines
2.4 KiB
Batchfile
@echo off
|
|
REM Complete Fix for All IIS + Node.js Issues
|
|
REM Run as Administrator - ONE TIME FIX
|
|
|
|
echo ========================================
|
|
echo COMPLETE FIX - ALL ISSUES
|
|
echo ========================================
|
|
echo.
|
|
|
|
cd /d "%~dp0"
|
|
|
|
REM Check Admin
|
|
net session >nul 2>&1
|
|
if %errorLevel% neq 0 (
|
|
echo [ERROR] Run as Administrator!
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
echo [1/7] Checking Node.js...
|
|
where node >nul 2>&1
|
|
if %errorLevel% equ 0 (
|
|
node --version
|
|
echo [OK] Node.js found
|
|
) else (
|
|
echo [ERROR] Node.js not found in PATH!
|
|
echo [INFO] Please install Node.js from nodejs.org
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
echo.
|
|
echo [2/7] Checking node_modules...
|
|
if exist "dist\node_modules" (
|
|
echo [OK] node_modules exists in dist
|
|
) else (
|
|
echo [WARNING] node_modules not in dist - copying...
|
|
if exist "node_modules" (
|
|
xcopy /E /I /Y /Q "node_modules" "dist\node_modules" >nul
|
|
echo [OK] node_modules copied
|
|
) else (
|
|
echo [ERROR] node_modules not found! Run: npm install
|
|
pause
|
|
exit /b 1
|
|
)
|
|
)
|
|
|
|
echo.
|
|
echo [3/7] Checking web.config...
|
|
if exist "dist\web.config" (
|
|
echo [OK] web.config exists
|
|
) else (
|
|
echo [ERROR] web.config not found!
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
echo.
|
|
echo [4/7] Setting folder permissions...
|
|
set IDENTITY=IIS AppPool\PozoApp
|
|
icacls "dist" /grant "%IDENTITY%:(OI)(CI)F" /T >nul 2>&1
|
|
if %errorLevel% equ 0 (
|
|
echo [OK] Permissions set
|
|
) else (
|
|
echo [WARNING] Could not set permissions automatically
|
|
)
|
|
|
|
echo.
|
|
echo [5/7] Unlocking handlers (if needed)...
|
|
C:\Windows\System32\inetsrv\appcmd.exe unlock config -section:system.webServer/handlers >nul 2>&1
|
|
if %errorLevel% equ 0 (
|
|
echo [OK] Handlers unlocked
|
|
) else (
|
|
echo [INFO] Handlers unlock attempted
|
|
)
|
|
|
|
echo.
|
|
echo [6/7] Setting Node.js environment for IIS...
|
|
powershell -Command "$ErrorActionPreference = 'SilentlyContinue'; Import-Module WebAdministration; $nodePath = (Get-Command node).Source; $nodeDir = Split-Path $nodePath; [Environment]::SetEnvironmentVariable('Path', $env:Path + ';' + $nodeDir, 'Machine'); Write-Host '[OK] Node.js added to system PATH'"
|
|
|
|
echo.
|
|
echo [7/7] Restarting IIS...
|
|
iisreset /noforce
|
|
|
|
echo.
|
|
echo ========================================
|
|
echo ALL FIXES APPLIED!
|
|
echo ========================================
|
|
echo.
|
|
echo Next Steps:
|
|
echo 1. Open browser: http://localhost
|
|
echo 2. If error, check: dist\iisnode\ logs
|
|
echo 3. Verify: IIS Manager ^> PozoApp ^> Browse
|
|
echo.
|
|
pause
|
|
|