Search code examples
msdeploy

How to use msdeploy to deploy an existing website on remote server


I already created a website "MyWebsite" on IIS on Windows server 2012, the physical path is C:\builds\MyWebsite\wwwroot, there are 1 other folders approot under directory C:\builds\MyWebsite, which is also necessary to make the website run. What I want to do is:

  1. create a new folder C:\builds\MyWebsiteNewBuild in remote server which will be used to put my new build;
  2. dump my new build D:\Release\PublishOutput from my local machine to the remote server, the publish output has 2 sub folders: wwwroot and approot;
  3. change the physical path of "MyWebsite" to the new created folder C:\builds\MyWebsiteNewBuild\wwwroot, and restart the service.

I am new to the msdeploy, I searched and it seems that I can use

    msdeploy.exe -verb:dump-source:contentPath="D:\Release\PublishOutput" -dest:contentPath="C:\builds\MyWebsiteNewBuild",computerName="https://**.**.**.**/MsDeploy.axd",userName='administrator',password="*****",authType='Basic' -allowUntrusted

to dump my new build to remote server's destination folder, but the other requirements, such as change the physical path of my existing website, I don't know how to do.


Solution

  • You could change the website path using the appcmd through WebDeploy by using a manifest.

    <runcommand path="%windir%\system32\inetsrv\appcmd set app /app.name:&quot;Default Web Site/app12&quot; /&#91;path='/'&#93;.physicalPath:C:\temp\app12" waitInterval="5000"/>
    

    http://www.dotnetcatch.com/2016/06/28/webdeploymsdeploy-quick-tip-change-iis-siteapp-physical-path-with-msdeploy/

    The following post describes how to create a custom WebDeploy package based on a manifest:

    http://www.dotnetcatch.com/2016/06/23/deploy-an-asp-net-website-not-web-application-with-msdeploy/