简体   繁体   English

MSDeploy和“维护站点”页面

[英]MSDeploy and “site under maintenance” page

I am new to MSDeploy as well as IIS admin. 我是MSDeploy和IIS管理员的新手。

In order to show a "site under maintenance" page we are looking at two alternatives. 为了显示“维护中的网站”页面,我们正在寻找两种选择。

1) Have an app_Offline.htm page and sync it to the server when maintenance starts. 1)有一个app_Offline.htm页面,并在维护开始时将其同步到服务器。

2) Create a separate folder with a totally different site (which can show a lot more dynamic information than what we can with the app_offline page). 2)创建一个具有完全不同的站点的单独文件夹(它可以显示比app_offline页面更多的动态信息)。 During maintenance, it is being suggested that we change the virtual folder mapping of the site to point to this other folder while we work on updating the site. 在维护期间,建议我们在更新站点时更改站点的虚拟文件夹映射以指向此其他文件夹。

Is there a way to change the virtual folder to point to another folder using MSDeploy? 有没有办法使用MSDeploy将虚拟文件夹更改为指向另一个文件夹? Is there any other way to do this via a script rather than having to go to each server and manually change the folder ? 有没有其他方法通过脚本执行此操作,而不必去每个服务器并手动更改文件夹?

Set app_offline using MSDeploy 使用MSDeploy设置app_offline

What we've done in the past is to script our deployments using Msdeploy.exe. 我们过去所做的是使用Msdeploy.exe编写部署脚本。 We execute 3 commands. 我们执行3个命令。

  1. The first command deploys the app_offline.htm page. 第一个命令部署app_offline.htm页面。

    msdeploy -verb:sync -source:filePath=c:\\location\\app_Offline.htm -dest:filePath=c:\\site\\app_Offline.htm msdeploy -verb:sync -source:filePath = c:\\ location \\ app_Offline.htm -dest:filePath = c:\\ site \\ app_Offline.htm

  2. Second we actually deploy the site using that same "sync" verb but using a package. 其次,我们实际使用相同的“同步”动词部署网站,但使用包。

  3. Third we'll remove the app_offline.htm using MSdeploy. 第三,我们将使用MSdeploy删除app_offline.htm。

    msdeploy -verb:delete -dest:filePath=c:\\site\\app_Offline.htm msdeploy -verb:delete -dest:filePath = c:\\ site \\ app_Offline.htm

You can execute msdeploy across multiple servers using the "computername" destination switch. 您可以使用“computername”目标开关跨多个服务器执行msdeploy。 Like: 喜欢:

msdeploy -verb:sync -source:filePath=c:\location\app_Offline.htm,computername=sourcemachine  -dest:filePath=c:\site\app_Offline.htm,computername=destmachine  

You can find more information about all the different parameters for using msdeploy via command line here: http://technet.microsoft.com/en-us/library/dd568991%28WS.10%29.aspx 您可以在此处找到有关通过命令行使用msdeploy的所有不同参数的更多信息: http ://technet.microsoft.com/en-us/library/dd568991%28WS.10%29.aspx

Creating a virtual directory using MSDeploy 使用MSDeploy创建虚拟目录

If you still want to create the virtual directory what I'd suggest is creating a powershell script on each destination sever that would do this for each server. 如果您仍想创建虚拟目录,我建议在每个目标服务器上创建一个powershell脚本,以便为每个服务器执行此操作。 Your powershell script would have something like this in it: 您的powershell脚本中会包含以下内容:

New-Item 'IIS:\\Sites\\Default Web Site\\VirtualDirName' -type VirtualDirectory -physicalPath c:\\test\\virtualDirectory1 New-Item'IIS:\\ Sites \\ Default Web Site \\ VirtualDirName'-type VirtualDirectory -physicalPath c:\\ test \\ virtualDirectory1

You can find more info about using powershell for this here: http://learn.iis.net/page.aspx/433/powershell-snap-in-creating-web-sites-web-applications-virtual-directories-and-application-pools/ 你可以在这里找到关于使用powershell的更多信息: http//learn.iis.net/page.aspx/433/powershell-snap-in-creating-web-sites-web-applications-virtual-directories-and-应用程序池/

Then execute using msdeploy utalizing the "runcommand" provider. 然后使用msdeploy执行umandizing“runco​​mmand”提供程序。 You would execute this line per server. 您将为每个服务器执行此行。

msdeploy -verb:sync -source:runCommand="net start createvirtualdir.ps" -dest:computername=destmachine

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM