Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/30.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net web部署包到IIS服务器的Powershell脚本(远程)_Asp.net_Visual Studio 2010_Iis_Powershell - Fatal编程技术网

Asp.net web部署包到IIS服务器的Powershell脚本(远程)

Asp.net web部署包到IIS服务器的Powershell脚本(远程),asp.net,visual-studio-2010,iis,powershell,Asp.net,Visual Studio 2010,Iis,Powershell,我是一名开发人员,但我没有部署包的权限。如果我向我的网络管理员提供powershell脚本和Web部署包(.zip),他会将其部署到服务器 Power shell需要询问部署路径(IIS网站路径)。脚本必须拾取WDP,提取它,并部署到IIS服务器上的给定路径 Example: ExampleMVC.zip (WDP) path: \\iisprod1\inetpub\wwwroot\iapps 现在我想把这个包部署到那个路径。我该怎么做呢?ZIP部署包通常附带一个.cmd文件(以及一些xml

我是一名开发人员,但我没有部署包的权限。如果我向我的网络管理员提供
powershell脚本
Web部署包(.zip)
,他会将其部署到服务器

Power shell需要询问部署路径(IIS网站路径)。脚本必须拾取WDP,提取它,并部署到IIS服务器上的给定路径

Example: ExampleMVC.zip (WDP)
 path: \\iisprod1\inetpub\wwwroot\iapps

现在我想把这个包部署到那个路径。我该怎么做呢?

ZIP部署包通常附带一个.cmd文件(以及一些xml文件),该文件应使用
/Y
参数运行,以便在当前计算机的IIS web服务器上部署包。如果要更改web应用程序路径,请在visual studio中构建ZIP包时进行更改。

只需使用批处理脚本就更容易了。我会将要部署到的路径添加到一个单独的文件中。可以这样做:

@echo off
set "scriptPath=/where/the/files/are"
for /F %%a IN (deployment-list.txt) DO (
     REM Will prompt for password and set T: (temp) drive to path
     net use T: \\%%a /u:administrator *
     copy %scriptPath%\ExampleMVC.zip t:\
     net use t: /d
)
 REM Will prompt for password and set T: (temp) drive to path
 net use T: \\iisprod1\inetpub\wwwroot\iapps /u:administrator *
 copy \path\to\file\ExampleMVC\* t:\
 net use t: /d
或者只使用一条路径而不使用循环:

 REM Will prompt for password and set T: (temp) drive to path
 net use T: \\iisprod1\inetpub\wwwroot\iapps /u:administrator *
 copy \path\to\file\ExampleMVC.zip t:\
 net use t: /d
此外,如果您希望提取内容,只需先提取内容,然后复制内容,或者如下所示:

@echo off
set "scriptPath=/where/the/files/are"
for /F %%a IN (deployment-list.txt) DO (
     REM Will prompt for password and set T: (temp) drive to path
     net use T: \\%%a /u:administrator *
     copy %scriptPath%\ExampleMVC.zip t:\
     net use t: /d
)
 REM Will prompt for password and set T: (temp) drive to path
 net use T: \\iisprod1\inetpub\wwwroot\iapps /u:administrator *
 copy \path\to\file\ExampleMVC\* t:\
 net use t: /d