setAclUser issue with msdeploy command line on local machine - iis

I am attempting to deploy a web application on a local IIS machine (IIS 8.0) via msdeploy.exe from a command line.
When I run from the command line:
"%ProgramFiles%\IIS\Microsoft Web Deploy V3\msdeploy.exe"
-verb:sync -source:package=Training.Mvc.Web.zip -dest:auto
-setParam:name="IIS Web Application Name",
value="D:\Release\WebSites\Training" -verbose
I get:
Error: A value for the 'setAclUser' setting must be specified when the 'setAcl'
provider is used with a physical path.
Error count: 1.
I have tried setting the setAclUser after the dest:auto, but that didn't work.

Considering my comment seemed to have done the trick, I thought I'd add it as an answer so the question can be marked as answered.
When you deploy to the file system the aclUser cannot be automatically determined, but if you set your destination to the name of the IIS website (which, tbh, this process was designed for) the application pool identity will be used.

Related

msdeploy -verb:sync webserver: 9000 error in destination event viewer

From Win2008-R2 to Win2012-R2:
The error on the destination is 9000 in the event log. Have looked high and low and do not see how to resolve this.
The command is:
msdeploy -verbose -verb:sync -source:webserver,computername=WIN-67E8GTGADGJ -dest:webserver,computername=192.168.2.21,userName="administrator",password="###"
On the cmd line, the error returned is:
Error: (8/25/2015 5:07:09 PM) An error occurred when the request was processed on the remote computer.
Error: The ApplicationHost.config file is invalid. Cannot proceed with synchronization.
Error count: 1.
On the destination system, there is an error in the event log:
Microsoft-Windows-IIS-APPHOSTSVC -- message 9000
It seems like there should be a way to solve. The target is sparkly clean Win2012-R2 with IIS role
There are no useful docs on the web to engage this.
Note: A commenter on this thread keeps saying that msdeploy does not support IIS 8.x. That commenter is wrong. http://www.iis.net/downloads/microsoft/web-deploy
There seems to be real problems with msdeploy, but no one seems to understand (or document) why. The tool is primarily built to go from IIS 6.x (Win 2003) to newer IIS.
In our experience, when going from IIS 7.x to 8.x, you often cannot use msdeploy with "source:webserver" approach. However, msdeploy can do a lot of the lifting for you from 7.x to 8.x.
Here are some steps I have seen work:
msdeploy -verbose -verb:sync -source:apphostconfig="WEB SITE NAME",computername=SOURCEMACHINE -dest:apphostconfig="WEB SITE NAME",computername=DESTINATIONMACHINE,userName="administrator",password="password-here" -enableLink:AppPoolExtension
Note the "enablelink" flag.
Repeat the above with:
-enableLink:CertificateExtension
and then
-enableLink:FrameworkConf
Once this is done, msdeploy has done all it can. You should now have the site migrated, with content and app pools, and ssl certs, and the configuration related to the sites and app pools.
For mime mappings, and other IIS system wide settings (compression is one example), you are on your own.

msdeploy failure: IIS 7.5->8.5: Error: The ApplicationHost.config file is invalid / eventlog error 9000 on destination system

Using v7.1 (that is the ver at cmd prompt), 3.6 (from web platform installer) of msdeploy.exe
Migrating from Win2008-R2 IIS to Win2012-R2
Attempting to move everything IIS related over. (And yes, we have customized applicatiohost.config, but we do not know all the mods... that is why we are using a migration tool,,, to move everything...)
Command I am running:
C:\Program Files\IIS\Microsoft Web Deploy V3>msdeploy
-verb:sync -source:webserver,
computername=WIN-67E8GTGADGJ
-dest:webserver,computername=192.168.2.21,
userName="administrator",password="###"
output:
Info: Using ID '1d59e6bd-0f89-4479-9853-98e164c9f613' for connections to the rem
ote server.
Info: Using ID '0c99bd7f-faa3-4737-ac35-d65c495402b6' for connections to the rem
ote server.
Info: Adding MSDeploy.webServer (MSDeploy.webServer).
Info: Adding webServer (MSDeploy.webServer/webServer).
Info: Adding appHostConfig ().
Error: (8/24/2015 10:28:43 PM) An error occurred when the request was processed on the remote computer.
Error: The ApplicationHost.config file is invalid. Cannot proceed with synchronization.
Error count: 1.
MORE INFORMATION
The sequence of events is:
Target system logs one error event:
Microsoft-Windows-IIS-APPHOSTSVC -- message 9000
And then msdeploy on the source system throws (and msdeploy exits):
Error: (8/25/2015 4:36:50 PM) An error occurred when the request was processed on the remote computer.
Error: The ApplicationHost.config file is invalid. Cannot proceed with synchronization.
Error count: 1.
UPDATE: Initially I was getting TWO event log errors on target system. Message 9000 and 9012. I was able to fix the 9012 by extending the applicationhost.config file. But hours of work and no solution yet for the 9000 error.
I have examined the ApplicationHost.config, and compared it to baseline, and there really seems to be nothing special there.
What is the path to resolution?
The answer is that there seems to be real problems with msdeploy, but no one seems to understand (or document) why. The tool is primarily built to go from IIS 6.x (Win 2003) to newer IIS.
In our experience, when going from IIS 7.x to 8.x, you often cannot use msdeploy with "source:webserver" approach. However, msdeploy can do a lot of the lifting for you from 7.x to 8.x.
Here are some steps I have seen work:
First, do three steps. This will let msdeploy move as much as it can (would be nice if it could move more, but this is as far as I have seen work):
msdeploy -verbose -verb:sync -source:apphostconfig="WEB SITE NAME",computername=SOURCEMACHINE -dest:apphostconfig="WEB SITE NAME",computername=DESTINATIONMACHINE,userName="administrator",password="password-here" -enableLink:AppPoolExtension
Note the "enablelink" flag.
Repeat the above with:
-enableLink:CertificateExtension
and then
-enableLink:FrameworkConf
Once this is done, msdeploy has done all it can. You should now have the site migrated, with content and app pools, and ssl certs, and the configuration related to the sites and app pools.
For mime mappings, and other IIS system wide settings (compression is one example), you are on your own.
Don't ask me why there is no document on how to do this. (Don't ask me why msdeploy can't just do the whole freaking server. It works great from IIS 6, but not from IIS 7, like what kind of crazy is that? Anyway, send Satya an email about it.)

msdeploy: allowuntrusted is being ignored

I have a machine [A] running fresh installation of Win2008 R2 which holds a webapp on IIS. I try to use msdeploy command line tool on machine [B] to publish a deployment package to this machine, but i keep on getting error regarding certificate.
I am using -allowuntrusted, but it still keeps on giving the same error.
I've been trying different things (like changing msdeploy port on IIS, installing certificate on the other machine, reinstall iis roles, tons of other) for 2 days now with absolutely no luck.
This is what I run:
msdeploy.exe -verb:sync -source:package="Web.zip" -dest:auto,ComputerName="https://machineA:8173/msdeploy.axd?site=app.com",UserName="AdminUser",Password="SecurePassword",AuthType="Basic" -allowUntrusted
To make things more interesting, this is what I get when I run the same command on the IIS-containing machine (even after changing dest to sync):
Error: A '-dest' argument must be specified with the 'sync' verb.
Error count: 1.
Any ideas?
EDIT:
I tried using the same settings (ip, package, authentication) in Visual Studio 2012 to create a publishing profile which deploys. After hitting "Verify connection", I got a popup asking if I want to accept this untrusted certificate. I clicked yes and went on to publish - that went through just fine.
Is there a way to get this behaviour with msdeploy command line? Using VS2012 is not an option for me, since publishing must be done automatically.
EDIT 2:
The fun continues: it works on another Windows Server 2008 R2 target machine (not a clean install though). So, where's the magic checkbox? :)
So, I managed to figure out 2 solutions:
Get a valid certificate (we had one in company, so playing around with hosts on machine [B] to match IP with company's domain, helped).
Place "-allowUntrusted:true" BEFORE "-dest" instead of at the end. No clue why does it work on one but not another machine.
Hope this helps someone to save some time :)
I see some problems with the command:
Unless you have changed the default port, you should be using 8172 and not 8173.
Secondly there is a double quote before securepassword but I don't see a closing double quote.
Your package most likely has some default parameters for which you must be specifying values during deployment.
msdeploy.exe -verb:sync -source:package="Web.zip" -dest:auto,ComputerName=https://machineA:8172/msdeploy.axd?site=app.com,UserName="AdminUser",Password="SecurePassword",AuthType="Basic" -allowUntrusted -setParam:paramname=value

msdeploy mvc to Windows7 getting ERROR_DESTINATION_NOT_REACHABLE and 404

I'm trying to do msdeploy of a MVC app to a windows7 box, running on command-line. And kept getting this error:
Error Code: ERROR_DESTINATION_NOT_REACHABLE
More Information: Could not connect to the destination computer ("192.168.xxx.xxx"
). On the destination computer, make sure that Web Deploy is installed and that
the required process ("The Web Management Service") is started.
Error: The remote server returned an error: (404) Not Found.
Error count: 1.
I've verified both Wmsvc (seems this is being used) and MsDepSvc are running. And firewall are disabled. In the browser when I visit https://192.168.xxx.xxx:8172/msdeploy.axd, I got a Server Error 404, seems a bit further than where the command-line stopped.
Most of instructions on setting up IIS7 and Web deployment I could find online is for MS Servers. Both my local machine and the Windows7 machine has the same version of Msdeploy installed.
I had exactly the same issue with a VM on Azure, and the solution was to enable first the IIS Management Service and then install Web Deploy (I used Web Platform Installer). Seems that the installation order matters. You can find a blog entry I wrote about this here http://davidjrh.intelequia.com/2012/10/configurando-web-platform-installer-y.html
For non-server operating systems (i.e. Windows 7) the Web Deploy publish via Web Management Service is not supported. Instead you will have to use the Remote Agent Service, this is an admin only publishing service. You can find more info at http://technet.microsoft.com/en-us/library/dd569059(v=WS.10).aspx.
I had the same issue using MSDeploy to deploy my web application to remote IIS 7.5 web server running windows 7. I have just figured out how to fix the problem today after reading Sayed's post, so I wanna post my solution here for anyone who would run into this problem like me. Try this:
Enable IIS Management Service (in control panel >> add or remove features >> add or remove windows features)
Install Web Deploy (http://www.iis.net/downloads/microsoft/web-deploy)
Open cmd with Administrative privilege, type “net start msdepsvc” to start the “Web Deploy Agent Service”.
Check this link in your browser: http://serveraddress/MsDeployAgentService/, if it prompts for username and password, MsDeployAgentService is running on server, go to the next step.
In VS, type in http://serveraddress/MsDeployAgentService/ in Service URL while creating publish, instead of https://serveraddress:8172/MsDeploy.axd, and click test connection. It should be ok now.
After checking the Management Service and Web Deploy 3.0 were correctly installed, I found that (from VS2012 at least) the Service URL seems to matter here too, attempting to publish to any of the following did not work for me:
FQDN (localmachine.domain.local)
Domain IP Address (172.22.xxx.xxx)
Loop-back IP (127.0.0.1)
Whereas the following DID work:
localhost
NetBIOS name (localmachine)

Set application pool with MSDeploy and TFS 2010

I'm trying to deploy website with MSDeploy and team build using some of this ...
/p:DeployOnBuild
/p:DeployTarget=MsDeployPublish
/p:CreatePackageOnPublish=True
/p:MSDeployPublishMethod=InProc
/p:MSDeployServiceURL=localhost
/p:DeployIISAppPath="Default Web Site"
Is there a way to set this website in custom application pool?
If you're using IIS 7, you can use the appPoolProvider to sync application pools to a remote server. See:
http://technet.microsoft.com/en-us/library/dd569070(WS.10).aspx
and
http://blog.torresdal.net/2010/08/16/NoClickWebDeploymentPart2WebDeployAkaMsdeploy.aspx
However, I wasn't able to really get that to work well, and if you're using IIS 6 this won't work anyway. What you can do though is leverage MSDeploy to run a couple commands on the remote server to set the application pool (and register the .NET version on the website).
First, create a batch file that contains something similar to the following:
cscript //nologo C:\Inetpub\AdminScripts\adsutil.vbs
SET w3svc/<IIS number>/Root/<virtual directory>/AppPoolid "<app pool name>"
So, if the IIS number is 1, your virtual directory is "MyDirectory" and the App Pool is named ".NET4.0", the command would be.
cscript //nologo C:\Inetpub\AdminScripts\adsutil.vbs
SET w3svc/1/Root/MyDirectory/AppPoolid ".NET4.0"
You can then run MSDeploy, passing this batch file in as an argument and running it on the remote machine:
MSDeploy
-verb:sync
-source:runCommand="<path to batch file>",waitinterval=5000
-dest:auto,computername=<computer name>
where <path to batch file> is the full path to the batch file you just created above, and is the computer against which you want to run this. Here is a link describing the runCommand argument: http://technet.microsoft.com/en-us/library/ee619740(WS.10).aspx
I'm sure you can set this up as a build step in TFS. We made a little .NET utility that we call as part of our deployment process that creates these batch files and runs the MSDeploy command.
There are also other things you can do in this same method that might prove useful to you:
Register an IIS version:
%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe
-s w3svc/1/root/MyDirectory
Create an App Pool:
CSCRIPT //nologo %dir%\adsutil.vbs
CREATE w3svc/AppPools/AppPoolName IISApplicationPool
Thanks to http://justsamson.com/2010/06/14/create-virtual-directory-in-iis-6-0-via-command-line/ for the command-line scripts to do the various functionality.
Part of the trick is with /p:IncludeAppPool=true. That changes the deploy script to enable AppPoolExtension. But I haven't figured out how best to actually set the app pool yet. :)

Resources