Bamboo Deployments using MSDeploy - msdeploy

I have created a CI with bamboo for a MVC Project. Build works fine but the problem is with the deployment using msdeploy. Below is the configuration of the deployment in Bamboo
Problem is with the arguments send to msdeploy which looks like this:
-source:package='${bamboo.build.working.directory}\Artifacts\WebDeploy\webdeploy.zip' -dest:auto,computerName="https://my_web_app.cloudapp.net:8172/msdeploy.axd?site=web_app_name",userName="deploy_user_name",password="passowrd",authtype="Basic",includeAcls="False" -verb:sync -disableLink:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtension -allowUntrusted -enableRule:DoNotDeleteRule -setParam:name="IIS Web Application Name",value="web_app_name"
When this code is run in bamboo, i am getting the following error:
Error: Unrecognized argument '"-setParam:name="IIS'. All arguments must begin with "-".
if -setParam:name="IIS Web Application Name",value="web_app_name" is removed from the script deployent is done with success but in a wrong website (virtual directory under Default Web Site)
Any ideas on how this can be fixed without using a separate .bat file?
Thanks

I dealt with a similar issue about a month ago. From everything I've seen, MSDeploy struggles to deal with arguments that have spaces in them. As a result, "IIS Web Application Name" will give you trouble. To overcome this, I excluded this argument and was able to achieve the same goal by including /p:Configuration=DeployIISAppPath="Default Web Site/web_app_name" in the MSBuild command line used to build the deployment package.

Related

TeamCity using MSDEPLOY ERROR_FILE_IN_USE

I have an ASP.NET 4.6.1 application that I am trying to deploy to a remote web server using TeamCity and MSBuild. Below is the MSBuild build step within TeamCity.
When I run the build in TeamCity, it always fails on this build step with a FILE_IN_USE_ERROR. The DLLs that are being updated before the error are usually the same, but sometimes they are different.
[MSBuild output] Info: Updating file (MyApp\bin\roslyn\Microsoft.VisualBasic.Core.targets).
[10:35:23]
[MSBuild output] Info: Updating file (MyApp\bin\roslyn\System.AppContext.dll).
[10:35:23]
[MSBuild output] Info: Updating file (MyApp\bin\roslyn\System.Collections.Immutable.dll).
[10:35:23]
[MSBuild output] MSDEPLOY : error Code: ERROR_FILE_IN_USE [C:\BuildAgent\work\b89cd3dfa447b\MyApp\MyApp.csproj]
I've already read through many articles (here, here, here, and here) suggesting that I drop an app_offline.htm file before deploying so that the IIS can re-route traffic and the file locking issues will stop. I tried that and it doesn't work. I still get the file in use issues during this build step.
I've also read in plenty of other discussions that another solution is to stop the application pool, deploy the app updates, and start the application pool. This is not a realistic solution because the deployment usually lasts between 15 and 20 minutes. Plus, this doesn't allow me to show a nice message to any current users.
I've been reading about this for a while now and it seems like this is a common use case for deployment to an IIS web server. Shouldn't this just work without locking files? Does anybody know of any other solutions to this problem?
I would try by stopping app pool to see if that`s a root cause of the issue.
But I'm not sure why it fails on .csproj file, because usually you don`t deploy those on server. So either it fails on different file (that is actually in use by web application) or it fails during build, not deploy (than app-pool stop will have no affect).

what is the difference between msdeploy and web deploy?

It looks like web deploy is just a different way of calling msdeploy? Ive read some documentation but still understand the difference between the two.
Its still referred to as the "Web Deploy tool" but I don't understand what distinguishes it from msdeploy.exe
Microsoft Web Deploy is the official name, while msdeploy is the name of the executable.
You can download and install Web Deploy from a place such as Microsoft Downloads,
https://www.iis.net/downloads/microsoft/web-deploy
And then you can use msdeploy command, as it is installed to
"C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe"
So in a simple way, the two are the same thing.

MSDeploy ALWAYS updating certain information?

I'm using MSDeploy to keep IIS Servers in sync. But, I'm receiving these messages all of the time now:
Info: Deleting binding (MSDeploy.appHostConfig/appHostConfig[#path='Default Web Site']/site[#name='Default Web Site']/bindings/binding).
Info: Adding child bindings (MSDeploy.appHostConfig/appHostConfig[#path='Default Web Site']/site[#name='Default Web Site']/bindings/binding).
I'm just doing the following:
"C:\Program Files (x86)\IIS\Microsoft Web Deploy V3\msdeploy.exe" -verb:sync -source:apphostconfig="Default Web Site" -dest:apphostconfig="Default Web Site",computername=[removeddestination]
The source server is 2008 and the destination is 2012. Is this normal? Or am I missing something.
I looked at the applicationHost.config files and they are about as close to being the same as I think the can be, realizing that they are different OSes and all.
This is just one example. I have several different updates that it says it's doing, but it really should be the same thing. All of them are of the "Updating Application" variety.
Thanks for any assistance.
Nick
You could try adding the -verbose flag to your msdeploy call to get more details about why its deleting and reading the binding.
Well, I took the -verbose command and added it to my deploy to figure out just what was causing it to show up. Seems almost all of them are items that were added in IIS 8.0. (And I'm on 7.5 of course). So I'll just take that as being an "expected" solution.
Thanks!

How to deploy package (zip) into specific site under IIS using msdeploy

Requirement:
I have zip package which i need to deploy into specific site (say dev.sitename.org) under IIS.
Earlier , we had site under Default Web Site (under IIS) and we used below command to deploy it.
>>msdeploy -verb:sync -source:package="D:\package.zip" -dest:auto
I have tried different provider for -dest , but nothing worked.
Does anyone has idea on this. Please share if any.
Try setting a ProviderPath parameter:
msdeploy -verb:sync -source:package="d:\package.zip" ^
-dest:auto -setParam:kind=ProviderPath,scope=iisApp,value=dev.sitename.org
Your provider might be a contentPath, rather than an iisApp, depending on how you created it. Open the manifest file in the root of the zip to double check.

How do I copy a file from a deployed web site to a local directory using MS Web Deploy (msdeploy.exe)?

I already came up with a command that deploys the site to the target server and it works great. In case it is important in this context, here it is:
"C:\Program Files (x86)\IIS\Microsoft Web Deploy V3\msdeploy.exe"
-source:package='HelloWorld.Mvc3UI\obj\Debug\Package\HelloWorld.Mvc3UI.zip'
-dest:auto,ComputerName='https://10.225.0.30:8172/MsDeploy.axd?site=HelloWorld',username='<MyUserName>',password='<MyPassword>',authType='basic',includeAcls='false'
-allowUntrusted
-verb:sync
-disableLink:AppPoolExtension
-disableLink:ContentExtension
-disableLink:CertificateExtension
-setParamFile:"HelloWorld.Mvc3UI\obj\Debug\Package\HelloWorld.Mvc3UI.SetParameters.xml"
-setParam:name='IIS Web Application Name',value='HelloWorld'
-setParam:name='HelloWorld-Web.config Connection String',value='SERVER=10.225.0.25;DATABASE=HelloWorld;UID=sa;PWD=<MyPassword>;'
Now that the site is on the server, I want to be able to retrieve the \bin\HelloWorld.Database.dll file and copy it to a local directory using msdeploy.exe.
I am guessing that I have to use the package provider on the remote server (since it is what was used to deploy the site) and use the dirPath or filePath provider on the local machine. However, I am having trouble working out the exact syntax to make it work.
Background
I need the HelloWorld.Database.dll file that is already in production so it can be used to downgrade the database in an application rollback scenario. This file uses the Fluent Migrator Framework to migrate the database changes.
I discovered a solution.
"C:\Program Files (x86)\IIS\Microsoft Web Deploy V3\msdeploy.exe"
-source:filePath='C:\inetpub\sites\HelloWorld\bin\HelloWorld.Database.dll',ComputerName='https://10.225.0.30:8172/MsDeploy.axd?site=HelloWorld',username='<MyUserName>',password='<MyPassword>',authType='basic',includeAcls='false'
-dest:filePath='F:\HelloWorldProject\HelloWorld.Database.dll'
-allowUntrusted
-verb:sync
However I would much prefer if there were a way to do this without having to specify the entire remote path because it might vary from one environment to the next. I tried and apparently it isn't supported.

Resources