Created
March 28, 2017 20:46
-
-
Save andrecarlucci/2bf8bde18ce76db6f8cb4e8f924c131f to your computer and use it in GitHub Desktop.
Script for configuring IIS for my microservices
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
SETLOCAL | |
SET project=%1 | |
SET service=%2 | |
SET dir=%3 | |
IF [%1] == [] GOTO ERROR_USAGE | |
IF [%2] == [] GOTO ERROR_USAGE | |
IF [%3] == [] GOTO ERROR_USAGE | |
SET cmd=C:\Windows\System32\inetsrv\appcmd.exe | |
SET dns=%project%-%service% | |
SET publishDir=%dir%\%project%\%service% | |
SET environmentVariablesScript=.\%project%.%service%\%project%.%service%\Properties\addEnvironmentVariables.bat | |
ECHO Configure IIS Script | |
ECHO Project : %project% | |
ECHO Service : %service% | |
ECHO Pub dir : %publishDir% | |
ECHO DNS : %dns% | |
ECHO Creating project dir | |
if not exist %publishDir% mkdir %publishDir% | |
ECHO Creating AppPool | |
%cmd% add apppool /name:%dns% /managedRuntimeVersion:"" | |
ECHO Creating %service% site | |
%cmd% add site /name:%dns% /bindings:http://%dns%.local.com:80 /physicalpath:%publishDir% | |
ECHO Add %service% to apppool | |
%cmd% set app "%dns%/" /applicationpool:%dns% | |
ECHO Add Environment Variables | |
IF EXIST %environmentVariablesScript% CALL %environmentVariablesScript% %dns% | |
ECHO Adding host entry | |
ECHO 127.0.0.1 %dns%.local.com >> c:\windows\system32\drivers\etc\hosts | |
GOTO EOF | |
ENDLOCAL | |
:ERROR_USAGE | |
ECHO Usage: configureiis.bat [project] [service name] [pub directory] | |
GOTO EOF | |
:EOF | |
ECHO END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment