Microsoft Developer Network >
Forums Home
>
Microsoft Visual Studio 2010 Release Candidate Forums
>
Web Development
>
Publish settings in VS 2010 beta 2 problems
Publish settings in VS 2010 beta 2 problems
- Hello,
I am able to deploy using msdeploy from command prompt using the verb "sync" with source and dest specified with "contentPath" property.
My set up is source IIS 7.0 destination IIS 6.0.
However, whenever I use the Publish window in VS 2010 I get (401) Unauthorized.
What is the command used by VS and what could be done to my setup to make it work? Is there a way to edit this default command?
Also I would like to have a compiled version only on my server machine but I don't see the option to do that.. I there a way not to publish my source code but only the compiled site?
All Replies
- I have a thread in the IIS forum about my initial issues:Then I had to write here since it seems this is a VS 2010 problem.Here a list of a few points that I believe being bugs in VS 2010 publish:1. You are forced to use https2. You are forced to finish the url with "msdeploy.axd"3. It automatically transform your URL adding the querystring of your site (used for wmsvc for IIS 7.0) so it's not possible to use it with IIS 6.04. If it was meant only for iis 7 it should be stated somewhere.It would be very appreciated if you liaise with the IIS team to further integrate the deployment into the IDE.Also please reply to the questions in my previous post when you have the time.Thanks
- Thank you for the feedback. We are working on improving the VS 2010 deployment experience with MSDeploy for future releases.
Items 1-3 are all related to the fact that Beta2 only supports the IIS 7 WMSvc handler when using One Click Publish. VS 2010 does allow you to create MSDeploy packages that can be deployed on IIS 6 or 7 machines. The "Create Package" menu option on the "Project" menu will create a package based on the settings contained on your project's "Package/Publish" property tab. After the package is created you can copy the package directory to your server and run the supplied command file or use MSDeploy from the command line to publish the package to your server.
It appears item 4 is not contained in the help files for beta 2, but I would encourage you to look for further MSDeploy integration with the next VS release.
Thanks,
Ben Byrd
Visual Web Developer Team - Thank you, I am looking forward to the next VS release then.BTW apart from those glitches I find that in general you are doing a very good job with this versionMarco
Items 1-3 are all related to the fact that Beta2 only supports the IIS 7 WMSvc handler when using One Click Publish. VS 2010 does allow you to create MSDeploy packages that can be deployed on IIS 6 or 7 machines. The "Create Package" menu option on the "Project" menu will create a package based on the settings contained on your project's "Package/Publish" property tab. After the package is created you can copy the package directory to your server and run the supplied command file or use MSDeploy from the command line to publish the package to your server.
@Ben - Thanks for the feedback!
Ben Byrd
Visual Web Developer Team
VS 2010 Beta2 One Click with MSDeploy is definitely good stuff! I've been able to get One Click "Publish..." working to my IIS 7.5 server (which is running WMSVC and MsDepSvc and has been configured with proper delegated permissions). And as you outline, I've been able to manually take packages from VS 2010 Beta2 "Create Package" and copy them across to my IIS 7.5 server, run them, and successfully install that way.
However, I'm reading between your lines above. Are you saying that running MSDeploy from command line with to sync a VS 2010 Beta2-generated package to a remote IIS 7.5 server is known not to work? I'd like to be able to automate my builds and do command-line deployments in that kind of way. I've been trying to tweak MSDeploy commands every way since Sunday to deploy a client-side package to a remote server (via wmsvc=xxx) and no matter what I do, I get "(401) Unauthorized". I am able to get a "-source:appconfig=Xxx,... -verb:dump" MSDeploy command to work from my client machine towards my server indicating that the userName and password and permissions for that are indeed correct and work for MSDeploy command-line. And one click "Publish..." works so I know server side permissions to support the deployment are correct. But if MSDeploy sync of a VS 2010 Beta2-generated package from command-line on a client machine to remote IIS 6 or 7 machines using wmsvc is known not to work in Beta2, I'll stop trying.
Please advise. Happy to post details if it helps.
Thanks.
-Andy
- Hi Andy,
You should be able to use the Web Deployment Tool (MsDeploy) from the command line to deploy a VS Web Deployment package. In Beta 2, VS does not support MsDeploy's Remote Agent Service, but you should be able to deploy a package from the command line using MsDeploy to the Web Deploy handler using WMSvc or the Remote Agent Service.
I see you are mentioning both IIS 6 (Remote Agent Service) and IIS 7 (Web Deploy Handler using WMSvc or Remote Agent Service), can you give me more details about the environment you are trying to publish to? You can also look at the batch file provided in the package directory to look at the command line agruments we pass MsDeploy.
From the error message an issue could that the "site" you are publishing it is not created. If you are publishing to the Web Deploy handler, have you tried publishing to this exact location (server, site, and app) using one-click publishing?
Thanks,
Ben Hi Andy,
You should be able to use the Web Deployment Tool (MsDeploy) from the command line to deploy a VS Web Deployment package. In Beta 2, VS does not support MsDeploy's Remote Agent Service, but you should be able to deploy a package from the command line using MsDeploy to the Web Deploy handler using WMSvc or the Remote Agent Service.
I see you are mentioning both IIS 6 (Remote Agent Service) and IIS 7 (Web Deploy Handler using WMSvc or Remote Agent Service), can you give me more details about the environment you are trying to publish to? You can also look at the batch file provided in the package directory to look at the command line agruments we pass MsDeploy.
From the error message an issue could that the "site" you are publishing it is not created. If you are publishing to the Web Deploy handler, have you tried publishing to this exact location (server, site, and app) using one-click publishing?
Thanks,
Ben
Thanks, Ben. My target environment is IIS 7.5 running WMSvc. Beta2 one-click publish to this target works fine. In the "Publish..." screen, the settings are:
Service URL: <iis_machine_ip_address>
Site/Application: <site>/<application>
Mark as IIS application on destination: CHECKED
Do not delete extra files on destination: UNCHECKED
Allow Untrusted Certification: CHECKED
User Name: <username>
Password: <password>
The <site>/<application> on the target IIS 7.5 machine already exists. An IIS Manager User has been configured named <username> on target IIS machine and one-click deployment using that login works fine. I can successfully deploy using the one-click Publish... screen just fine. But I want to automate that so I can do deploys right out of our build scripts.
I'm trying to do exactly what you hint at in your suggestions. Since one-click publish to the destination works, I'm trying to figure out how to take the generated <app>_deploy.cmd file and tweak it so that I can run it on the build machine and do a remote deployment to the same remote target as the one-click publish. So what I've done is told VS 2010 Beta2 instead of "Publish..." (which works) to do "Create Package". And I get four output files: <app>_deploy.cmd, <app>.SetParameters.xml, <app>.SourceManifest.xml, and <app>.zip. When I take these four files and copy them across to my IIS 7.5 machine manually, and then on that machine as administrator run "<app>_deploy.cmd /y" it works. But for the life of me, when I try to modify "<app>_deploy.cmd" so that it can be run on the build machine (my Win7 dev machine complete with VS 2010 Beta2) and to target the IIS 7.5 server remotely just like "Publish..." one-click does, it doesn't work. I've been getting 401 errors, mostly.
Here's one of my tweaks of the <app>_deploy.cmd file trying to get "<app>_deploy.cmd /y" to do a remote publish:
"%MSDeployPath%\msdeploy.exe" -source:package='%RootPath%<app>.zip' -dest:webServer,computerName=https://<iis_machine_ip_address>:8172/msdeploy.axd?site=<site>/<app>,authType=basic,userName=<userName>,password=<password>,IncludeAcls='False' -verb:sync -disableLink:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtension -skip:objectname='dirPath',absolutepath='obj\\Debug\\Package\\PackageTmp\\App_Data$' -setParamFile:"%RootPath%MvcApp.SetParameters.xml" -allowUntrusted -verbose
As you can see, I'm trying to take the working params out of the "Publish..." screen and plug them into <app>_deploy.cmd figuring since they worked for remote deploy right inside "Publish..." screen, they should work in MSDeploy command line too. But, clearly, I've been unable to figure out exactly what MSDeploy provider options and parameters that "Publish..." is invoking and have been unable to get an automatable command-line call to MSDeploy to do deploy to remote WMSvc machine (IIS 7.5 server) to work.
Thanks for any guidance you can provide! I'm hoping you know the MSDeploy provider options and parameters that one-click Publish... is invoking. (And then I could just pass those to MSDeploy myself in my build/deploy scripts.)
-Andy
- @Ben / Microsoft - Any hints on what MSDeploy options VS 2010 Beta 2 uses on Publish...? Would appreciate any guidance. (See above for details.)
Thanks!
-Andy
- Bump.
-Andy - Sorry Andy, for some reason I did not get notified about your other posts.
In modifying the cmd file I changed line 72 to be:
"%MSDeployPath%\msdeploy.exe" -source:package='%RootPath%WebApplication2.zip' -dest:auto,computername=https://<machineName>:8172/msdeploy.axd?site=default%%20Web%%20Site,authType=basic,username=<UserName>,password=<Password>,IncludeAcls='False' -verb:sync -disableLink:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtension -setParamFile:"%RootPath%WebApplication2.SetParameters.xml" -skip:objectname='dirPath',absolutepath='PackageTmp\\App_Data$' -allowUntrusted
This is deploying to a site and using the information from the "IIS Web Site/Application name ..." to set the App. I added the skip rule for App_Data, but on the Package/Publish tab you could mark "Exclude files from the App_Data folder".
Another option is to use msbuild. You can use the follow command as a reference:
msbuild "{PathToProject}\WebApplication2.vbproj" /t:MsDeployPublish /p:MsDeployServiceUrl=https://{computerName}:8172/msdeploy.axd;AllowUntrustedCertificate=true;DeployIisAppPath="default web site/TestMsbuildDeploy";username={Username};password={Password}
Adding ";ExcludeApp_Data=True" will stop us from deploying the content of the App_Data folder and adding ";SkipExtraFilesOnServer=True" will make sure any existing files do not get delete.
Ben- Proposed As Answer byAndy Fraley Tuesday, January 26, 2010 7:40 PM
- Thank you Ben!
There were two subtle differences between your MSDeploy CMD file and mine:
1) I specified "-dest:webServer" whereas you specified "-dest:auto"
2) I specified "computerName=https://<iis_machine_ip_address>:8172/msdeploy.axd?site=<site>/<app>" whereas you specified "computerName=https://<iis_machine_ip_address>:8172/msdeploy.axd?site=<site>" (without the "/<app>")
When I tweaked these two things in my CMD file, it worked!
Thanks for your help.
-Andy
