Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deployment issue of an web application using MSDeploy command

Tags:

msdeploy

I have a web application and I am trying to deploy it on a webserver using MSDeploy.exe (Web Deploy 2)

I have tried 4 scenarios:

  1. Through VS2010 Publish method with following settings:
    Publish Method: Web Deploy
    Service Url: https://MyServerName:8172/MsDeploy.axd
    Site/application: MyWebSiteName
    Allow untrusted: checked
    Username: MyUsername
    Password: MyPassword
    This method works just fine.
    On MyServerName machine I have Web Management Service running; I have a website MyWebSiteName, an application MyWebAppName and MyUserName is an IIS Manager for it.

  2. Through VS2010 Publish method with following settings:
    Publish Method: Web Deploy
    Service Url: https://MyServerName:8172/MsDeploy.axd
    Site/application: MyWebSiteName/MyWebAppName
    Allow untrusted: checked
    Username: MyUsername
    Password: MyPassword
    This method works just fine.

  3. Through MSDeploy.exe command line (within a Powershell script)
    $Source = "contentPath='...._PublishedWebsites\MyWebApp'"
    $Destination = "contentPath=MyWebSiteName,computerName='https://fc-wapps-trial:8172/MsDeploy.axd?Site=WebSiteTest',Username=MyUsername,Password=MyPassword,AuthType=basic"
    MSDeploy -verb:sync -source:$Source -dest:$Destination -allowUntrusted
    This method also works fine.

  4. Through MSDeploy.exe command line (within a Powershell script)
    $Source = "contentPath='...._PublishedWebsites\MyWebApp'"
    $Destination = "iisApp=MyWebSiteName/MyWebAppName,computerName='https://fc-wapps-trial:8172/MsDeploy.axd?Site=WebSiteTest/MyWebAppName',Username=MyUsername,Password=MyPassword,AuthType=basic"
    MSDeploy -verb:sync -source:$Source -dest:$Destination -allowUntrusted
    This method doesn't work. I am getting the following error.
    Error Code: ERROR_USER_UNAUTHORIZED
    More Information: Connected to the destination computer ("MyServerName") using the Web Management Service, but could not authorize. Make sure that you are using the correct user name and password, that the site you are connecting to exists, and that the credentials represent a user who has permissions to access the site.
    Error: The remote server returned an error: (401) Unauthorized.

I was looking at what is the actuall MSDeploy command that the method 2 uses and I got something like:
msdeploy.exe
-source:manifest='...\MyWebApp.SourceManifest.xml'
-dest:auto,ComputerName='https://MyServerName:8172/MsDeploy.axd?site=WebSiteTest',UserName='MyUsername',Password='MyPassword',IncludeAcls='False',AuthType='Basic'
-verb:sync
-disableLink:AppPoolExtension
-disableLink:ContentExtension
-disableLink:CertificateExtension
-skip:objectname='dirPath',absolutepath='...\App_Data$'
-setParam:kind='ProviderPath',scope='IisApp',match='^...\PackageTmp$',value=WebSiteTest/WebAppTest
-setParam:kind='ProviderPath',scope='setAcl',match='^..\PackageTmp$',value=WebSiteTest/WebAppTest
-allowUntrusted
-retryAttempts=2
Now this doesn't seem to be anything close to what I am using in method 4. I tried running it myself without success, but I assume I wasn't able to properly re-create all those parameters.

So my questions are:
- What I am doing wrong in method 4?
- How can I deploy a web application as a website application in IIS7 using MSDeploy.exe command


Thanks in advance for your help
Iulian

like image 339
Iulian Ilies Avatar asked Feb 24 '12 06:02

Iulian Ilies


People also ask

What is web application deployment?

Deploying a Web Application enables WebLogic Server to serve the components of a Web Application to clients. You can deploy a Web Application using one of several procedures, depending on your environment and whether or not your Web Application is in production.

How do you check web Deploy is installed or not?

Is Web Deploy installed? You can verify web deploy is installed by going to the "Programs and Features" control panel and looking for "Microsoft Web Deploy 2.0" in the list of installed programs. If it is not there, you can install it via the Web Platform Installer by going to the "Products" tab.

How do I deploy a web deployment package?

Create a web deployment package using the MSBuild command line, Team Build, or Visual Studio 2010. Copy the web package to the destination web server. Use the Import Application Package Wizard in IIS Manager to install the web package and provide values for variables like connection strings and service endpoints.


1 Answers

I ran into the same issue as you did. I solved it by only use site name in https://computername:8172/msdeploy.axd?site={websitenameonly}. Then set your webapplication path in the parameter using -setParam IIS Web Application Name= {your web application name here} or use a parameter file. And everything deployed fine.

It seems that the site querystring value is required to authorize the request only. I haven't find any definitive documentation from MS on any other querystring parameters that might solve this. But I actually tested 2 cases. 1) Deploying to a web site in IIS 7.5, this parameter is required. 2) Deploying to a web application under a web site, this parameter is actually optional, but if you want to include it, then it has to be a root site.

You actually answered your own question here just probably didn't realize it.

like image 96
Eric Ding Avatar answered Sep 22 '22 20:09

Eric Ding