I am new to MSDeploy as well as IIS admin.
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.
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). 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? 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
What we've done in the past is to script our deployments using Msdeploy.exe. We execute 3 commands.
The first command deploys the app_offline.htm page.
msdeploy -verb:sync -source:filePath=c:\location\app_Offline.htm -dest:filePath=c:\site\app_Offline.htm
Second we actually deploy the site using that same "sync" verb but using a package.
Third we'll remove the app_offline.htm using MSdeploy.
msdeploy -verb:delete -dest:filePath=c:\site\app_Offline.htm
You can execute msdeploy across multiple servers using the "computername" destination switch. 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
Creating a virtual directory using 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. Your powershell script would have something like this in it:
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/
Then execute using msdeploy utalizing the "runcommand" provider. You would execute this line per server.
msdeploy -verb:sync -source:runCommand="net start createvirtualdir.ps" -dest:computername=destmachine
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With