2018-11-30

Start Development IIS Express Server

Start Development IIS Express Server (tested on Win7 and Win10 with mapped network drives)

 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
@echo off
REM Script will start IIS Express on the specific port with the folder FROM WHICH SCRIPT IS CALLED
REM 
REM IIS Express does the following:
REM * Copies default applicationhost.config file ("C:\Program Files\IIS Express\AppServer\applicationhost.config") to %TEMP%\IISEXPRESS\APPLICATIONHOST{TimeStampGoesHere}.CONFIG (where timestamp is current date+time with milliseconds)
REM * The copied config file is modified to specify the physical path (<application ...> --> <virtualDirectory ...> physicalPath property) and the port (<bindings> -> <binding ...> bindingInformation property) 
REM * Path to custom configuration file can also be provided in the command line using /config:{FullPathToIISApplicationHostCustomConfigFile}

set iisexpress_loc="C:\Program Files\IIS Express\iisexpress.exe"
set folder_loc=%cd%
set port_loc=2018

if [%1]==[--help] goto syntax
if [%1]==[/?] goto syntax

if [%1]==[] goto proceed
set port_loc=%1

:proceed
echo.
echo Make "%folder_loc%" accessible from "http://localhost:%port_loc%" ...
echo.

%iisexpress_loc% /path:"%folder_loc%" /port:%port_loc% /trace:w /systray:true

goto exit

:syntax
echo.
echo Syntax: %0 PortNumberGoesHere
echo         Default Port: %port_loc%
echo.
goto exit

:exit
echo.
echo.
echo.
pause

No comments:

Post a Comment