.net 命令行发布及iis命令行部署

 1 echo Please use administrator privileges to run.
 2 ::请使用管理员权限执行
 3 cd /d %~dp0
 4 ::站点名称
 5 set name="test"
 6 ::绑定域名和端口号
 7 set domain=*:5000
 8 ::网站源文件物理路径
 9 set physicalPath="%cd%\web"
10 
11 
12 ::设置权限
13 echo Y|cacls %physicalPath% /T /G Everyone:F
14 ::删除同名网站
15 %systemroot%/system32/Inetsrv/APPCMD.exe delete site /site.name:%name%
16 ::删除同名程序池
17 %systemroot%/system32/Inetsrv/APPCMD.exe delete AppPool /AppPool.name:%name%
18 ::添加程序池
19 %systemroot%/system32/Inetsrv/APPCMD.exe add AppPool /name:%name% /managedRuntimeVersion:""
20 ::添加网站
21 %systemroot%/system32/Inetsrv/APPCMD.exe add site /name:%name% /physicalPath:%physicalPath% /bindings:"http/%domain%:"
22 ::设置程序池
23 %systemroot%/system32/Inetsrv/APPCMD.exe set site /site.name:%name% /[path='/'].applicationPool:%name%
24  
25 pause

 

 1 ::启动网站
 2 %systemroot%/system32/Inetsrv/APPCMD.exe start site /site.name:test 
 3 
 4 ::启动程序池
 5 %systemroot%/system32/Inetsrv/APPCMD.exe start AppPool /AppPool.name:test
 6 ::停止程序池
 7 %systemroot%/system32/Inetsrv/APPCMD.exe stop AppPool /AppPool.name:test
 8 
 9 @echo off
10 echo Please use administrator privileges to run.
11 ::请使用管理员权限执行
12 cd /d %~dp0
13 
14 ::复制文件夹
15 for /l %%i in (6070,1,6079) do xcopy gb.dir.api /d /s /e /i /h /c /y gb.dir.api%%i 
16 
17 pause
18  
19  ---发布-------------------------------------------------------------------------
20  @echo off
21 echo Please use administrator privileges to run.
22 ::请使用管理员权限执行
23 cd /d %~dp0
24 
25 ::设置权限
26 for /l %%i in (6070,1,6079) do echo Y|cacls %cd%\gb.dir.api%%i /T /G Everyone:F
27 
28 ::删除同名网站
29 for /l %%i in (6070,1,6079) do %systemroot%/system32/Inetsrv/APPCMD.exe delete site /site.name:gb.dir.api%%i
30 
31 ::删除同名程序池
32 for /l %%i in (6070,1,6079) do %systemroot%/system32/Inetsrv/APPCMD.exe delete AppPool /AppPool.name:gb.dir.api%%i
33 
34 ::添加程序池
35 for /l %%i in (6070,1,6079) do %systemroot%/system32/Inetsrv/APPCMD.exe add AppPool /name:gb.dir.api%%i /managedRuntimeVersion:""
36 
37 ::添加网站
38 for /l %%i in (6070,1,6079) do %systemroot%/system32/Inetsrv/APPCMD.exe add site /name:gb.dir.api%%i /physicalPath:%cd%\gb.dir.api%%i /bindings:"http/*:%%i:"
39 
40 ::设置程序池
41 for /l %%i in (6070,1,6079) do %systemroot%/system32/Inetsrv/APPCMD.exe set site /site.name:gb.dir.api%%i /[path='/'].applicationPool:gb.dir.api%%i
42 
43 
44 pause

 

posted @ 2021-10-11 09:58  博客园you  阅读(275)  评论(0编辑  收藏  举报