Webdeploy permission issue
Asked Answered
S

4

6

I have 3 web deploy (visual studio publish project to package) packages for which I use msdeploy command to sync with a server. One of the package was newly added. The other two packages work fine except for the newly added one. I see the following error in the log. I am not sure where to set the permission for this since the permissions for iisApp provider are already set in IIS Manager Delegation settings. I am new to IIS configuration and .net development. Can anyone provide info on why I am getting this error?

Here is the command used:

PS D:\Deployment> &'C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe'  -verb:sync -source:package='D:\temp\CI.Web.Pack_20130824.1\_PublishedWebsites\ProjectXYZ_Package\
ProjectXYZ.zip' -dest="auto,computerName='https://localhost:8172/msdeploy.axd?site=siteName',username
='deployUserName',password='deployPassword',authType=basic,includeAcls='False'" -skip:objectName=createApp -disableLink:AppPoolExtens
ion -disableLink:ContentExtension -disableLink:CertificateExtension -allowUntrusted
Info: Using ID '2b0c6151-a2b0-4a87-9135-263330c5e619' for connections to the remote server.
Info: Object createApp (D:\Builds\2\Mayo.KCMS\CI.Web.Pack\Sources\DEV\Web\ProjectXYZ\obj\Rele
ase\Package\PackageTmp) skipped due to skip directive 'CommandLineSkipDirective 1'.
Info: Adding sitemanifest (sitemanifest).
Info: Adding IIS Application (Default Web Site/ProjectXYZ_deploy)
Error Code: ERROR_USER_NOT_AUTHORIZED_FOR_IISAPP
More Information: Could not complete an operation with the specified provider ("iisApp") when connecting using the Web M
anagement Service. This can occur if the server administrator has not authorized the user for this operation. iisApp htt
p://go.microsoft.com/fwlink/?LinkId=178034  Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_USER_NOT_
AUTHORIZED_FOR_IISAPP.
Error count: 1.

Error on server:

wmsvc.exe Error: 0 : User: 
Client IP: ::1
Content-Type: application/msdeploy
Version: 9.0.0.0
MSDeploy.VersionMin: 7.1.600.0
MSDeploy.VersionMax: 9.0.1631.0
MSDeploy.Method: Sync
MSDeploy.RequestId: 6b694745-0024-416c-9439-3e97608417b9
MSDeploy.RequestCulture: en-US
MSDeploy.RequestUICulture: en-US
ServerVersion: 9.0.1631.0
Skip: objectName="^configProtectedData$"objectName="createApp"
Provider: auto, Path: 
A tracing deployment agent exception occurred that was propagated to the client. Request ID '6b694745-0024-416c-9439-3e97608417b9'. Request Timestamp: '8/26/2013 2:01:55 PM'. Error Details:
ERROR_USER_NOT_AUTHORIZED_FOR_IISAPP
Microsoft.Web.Deployment.DeploymentDetailedUnauthorizedAccessException: Could not complete an operation with the specified provider ("iisApp") when connecting using the Web Management Service. This can occur if the server administrator has not authorized the user for this operation. iisApp http://go.microsoft.com/fwlink/?LinkId=178034  Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_USER_NOT_AUTHORIZED_FOR_IISAPP.
   at Microsoft.Web.Deployment.DelegationHelper.ImpersonateForOperation(String deploymentAction, String deploymentProvider, String deploymentPath, DelegationContextCache cache)
   at Microsoft.Web.Deployment.DelegationHelper.ImpersonateForOperation(String deploymentAction, DeploymentObject deploymentObject)
   at Microsoft.Web.Deployment.DeploymentObject.Add(DeploymentObject source, DeploymentSyncContext syncContext)
   at Microsoft.Web.Deployment.DeploymentSyncContext.HandleAdd(DeploymentObject destObject, DeploymentObject sourceObject)
   at Microsoft.Web.Deployment.DeploymentSyncContext.SyncChildren(DeploymentObject dest, DeploymentObject source)
   at Microsoft.Web.Deployment.DeploymentSyncContext.SyncChildrenOrder(DeploymentObject dest, DeploymentObject source)
   at Microsoft.Web.Deployment.DeploymentSyncContext.ProcessSync(DeploymentObject destinationObject, DeploymentObject sourceObject)
   at Microsoft.Web.Deployment.DeploymentObject.SyncToInternal(DeploymentObject destObject, DeploymentSyncOptions syncOptions, PayloadTable payloadTable, ContentRootTable contentRootTable, Nullable`1 syncPassId)
   at Microsoft.Web.Deployment.DeploymentAgent.HandleSync(DeploymentAgentAsyncData asyncData, Nullable`1 passId)
   at Microsoft.Web.Deployment.DeploymentAgent.HandleRequestWorker(DeploymentAgentAsyncData asyncData)
   at Microsoft.Web.Deployment.DeploymentAgent.HandleRequest(DeploymentAgentAsyncData asyncData)

enter image description here

Shortbread answered 26/8, 2013 at 20:13 Comment(0)
S
8

I have found the solution for the problem. The third package was trying to create a new application on the server because of a different application name than the other two packages. I have added a new setParameters.xml file that has entry for the application name which will overwrite the default application name with the one the previous two packages were deploying to. I pass this setParameters.xml file as a parameter to the Webdeploy command.

&'C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe'  -verb:sync -source:package='D:\temp\Project_XYZ.zip' -setParamFile:setParameters.xml -dest="auto,computerName='https://localhost:8172/msdeploy.axd?site=siteName',username='deployUser',password='changeMe',authType=basic,includeAcls='False'" -skip:objectName=createApp -disableLink:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtension -allowUntrusted -whatif

setParameters.xml

<?xml version="1.0" encoding="utf-8"?>
<parameters>
  <setParameter name="IIS Web Application Name" value="siteName" />
</parameters>
Shortbread answered 3/9, 2013 at 14:26 Comment(2)
Thank you for posting your issue and solution, here is almost 2019 and I ran into the same error. I was trying to use VSTS to set-up Continuous Integration deployments to Arvixe (web host) and was getting the same error; it turned out that I was not properly setting the app name just as you noted. after I added a step in my release process to fix the setParameters.xml file, i can now use CI to push directly to my Arvixe and GoDaddy sites.Isonomy
This fixed it for me, note that it's also possible to do this from the command line, e.g.: msdeploy.exe ... -setParam:name="IIS Web Application Name",value="<value>" .Mouthpart
H
4

Unless the user is an administrator, you need to grant them access to deploy to the website. You can do so by right clicking on the website in IIS Manager and select Deploy :: Configure Web Deploy Publishing. Just select the user and click OK (you can delete the publish settings file it generates on the desktop)

Homesteader answered 3/9, 2013 at 11:58 Comment(1)
Thanks Rich! I have found the solution with what I am doing wrong. I had a wrong application name set in the setParameters.xml file.Shortbread
D
2

I had this exact problem, when I went to the non-admin deploy. This is a working command line after getting the 'ERROR_USER_NOT_AUTHORIZED_FOR_IISAPP' error. This eliminates the need for referring to the external setParams.xml, by using -setParam

Sadly it is the double reference to the 'sitename' in the setParams and in the computername string that makes this work. I tried eliminating one or the other, but I would always get the 'ERROR_USER_NOT_AUTHORIZED_FOR_IISAPP' error.

`"c:\program files\iis\microsoft web deploy v3\msdeploy"  -verb:sync -setParam:'IIS Web Application Name'='sitename' -source:package="package.zip" -dest:auto,computerName='https://machinename:8172/msdeploy.axd?site=sitename',username=username,password=password, -allowUntrusted=true`
Dalston answered 22/3, 2019 at 14:34 Comment(0)
F
0

I fixed this by uninstalling and then re-installing Web Deploy (both via running the Web Deploy installer).

See this question and its answers for what seems like the same, or at least a similar, issue:

Frequentation answered 6/11, 2017 at 16:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.