添加IIS站点和应用程序池,将两者绑定,添加本地域名host
set sitename=mysite
set poolname=%sitename%
set bindings=http/127.0.0.1:80:%sitename%
set physicalPath=D:\git\myexample
%windir%\system32\inetsrv\Appcmd add AppPool -name:%poolname%
%windir%\system32\inetsrv\Appcmd add site /name:"%sitename%" /bindings:"%bindings%" /physicalPath:"%physicalPath%"
%windir%\system32\inetsrv\Appcmd set app -app.name:%sitename%/ -applicationPool:%poolname%
echo 127.0.0.1 %sitename%>> %SystemRoot%\system32\drivers\etc\hosts
pause
%systemroot%和%windir%本地试了都是C:\Windows
echo %systemroot%
echo %windir%
网友评论