-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.bat
42 lines (35 loc) · 1.09 KB
/
setup.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
@echo off
set appcmd="C:\Windows\System32\inetsrv\appcmd.exe"
SET application=checkout-api.7digital.local
SET appPath=Api
::setup application pool
%appcmd% list apppool "%application%"
REM IF %ERRORLEVEL% EQU 0 (
%appcmd% delete apppool "%application%"
)
%appcmd% add apppool /name:"%application%" /managedRuntimeVersion:v4.0 /managedPipelineMode:Integrated
IF %ERRORLEVEL% NEQ 0 (
GOTO End
)
::setup website
%appcmd% list site "%application%"
IF %ERRORLEVEL% EQU 0 (
%appcmd% delete site "%application%"
)
SET root=%cd%
%appcmd% add site /site.name:"%application%" /bindings:http://%application%:80 /physicalPath:%root%\%appPath%
IF %ERRORLEVEL% NEQ 0 (
GOTO End
)
%appcmd% set app "%application%/" /applicationPool:%application%
IF %ERRORLEVEL% NEQ 0 (
GOTO End
)
::append entry to hosts file
SET findCmd="C:\Windows\system32\find.exe"
%findCmd% /c /i "127.0.0.1 %application% " C:\Windows\System32\drivers\etc\hosts
IF %ERRORLEVEL% NEQ 0 (
echo # >> %WINDIR%\System32\drivers\etc\hosts
echo 127.0.0.1 %application% >> %WINDIR%\System32\drivers\etc\hosts
)
:End