IIS7 + related answer ....
Ok - here's what I ended up doing. More or less, following the post by Simon Weaver in this thread/question.
But when it comes to the MSBuild settings .. most people here are using following setting: /p:MSDeployPublishMethod=RemoteAgent
which is NOT RIGHT for IIS7. Using this setting means TFS tries to connect to the url: https://your-server-name/MSDEPLOYAGENTSERVICE
But to access that url, the user to authenticate needs to be an Admin. Which is fraked. (And you need to have the Admin-override rule thingy ticked). This url is for IIS6 I think.
Here's the standard error message when you try to connect using RemoteAgent :-
Standard 401 Frak Off u suck RemoteAgent, error
C:\Program Files
(x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets
(3588): Web deployment task
failed.(Remote agent (URL
http://your-web-server/MSDEPLOYAGENTSERVICE)
could not be contacted. Make sure the
remote agent service is installed and
started on the target computer.) Make
sure the site name, user name, and
password are correct. If the issue is
not resolved, please contact your
local or server administrator. Error
details: Remote agent (URL
http://your-web-server/MSDEPLOYAGENTSERVICE)
could not be contacted. Make sure the
remote agent service is installed and
started on the target computer. An
unsupported response was received. The
response header 'MSDeploy.Response'
was 'V1' but 'v1' was expected. The
remote server returned an error: (401)
Unauthorized.
So .. you need to change your MSDeployPublishMethod
to this:
/p:MSDeployPublishMethod=WMSVC
The WMSVC
stands for Windows Manager Service. It's basically a newer wrapper over the Remote Agent but now allows us to correct provide a user name and password .. where the user does NOT have to be an admin! (joy!) So now you can correct set which users u want to have access to .. per WebSite ..
It also now tries to hit the the url: https://your-web-server:8172/MsDeploy.axd
<-- which is EXACTLY what the Visual Studio 2010 Publish
window does! (OMG -> PENNY DROPS!! BOOM!)
And here's my final MSBuild settings:
/p:DeployOnBuild=True
/p:DeployTarget=MSDeployPublish
/p:MSDeployPublishMethod=WMSVC
/p:MsDeployServiceUrl=your-server-name
/p:DeployIISAppPath=name-of-the-website-in-iis7
/p:username=AppianMedia\some-domain-user
/p:password=JonSkeet<3<3<3
/p:AllowUntrustedCertificate=True
Notice the username has the domain name in it? Ya need that, there. Also, in my picture, I've allowed our DOMAIN USERS access to the website for managament. As such, my new user account i added (TFSBuildService) has Membership to the Domain Users
group ... so that's how it all works.
Now - if u've read all this, have a lolcat (cause they are SOOOOOOOO 2007)....
I'm also starting to look into the possibilities on how to accomplish this.
I've still some research to do, but I can give you the following pointers:
IncludeAppPool=true enable the AppPoolExtension which also copies the app pool when synching a web site from one location to the other.
I guess it will not have an effect when creating a package. Unless maybe if you WAP is run via your local IIS and you include IIS Settings in your package.
Parameters.xml exists in the zip indeed. But if you place a Parameters.xml file in the root of your WAP you can specify your own parameters which will be merged with the one VS creates when packaging.
You can indeed check "Include application pool settings used by this Web project" (in fact: this sets the msbuild property IncludeAppPool to true). The manifest will then hold a entry for creating the app-pool. This is however only possible if you are creating the package from a machine that also locally runs the WAP. This is not an option when working with a build server which is my case
It could be possible to make a batch script to run msdeploy from the commandline and use the AppPool provider to create the apppool. Although this seems a bit clunky to me as I'd like to include the apppool creation inside the manifest of my VS (or build server) generated package
I'm right now investigating if it would be possible to insert the apppoolconfig provide inside my manifest using a wpp.targets file (more info here and here
I might get back to you if I find how to do it.
Edit:
I've found out that there is no way you can package the creation of a new app pool using the appPoolConfig provider. I was forced to write my own provider. I did that based on some (very basic) examples I found and by reverse engineering some of the existing providers. What I basically did was create a wrapper class that calls c:\windows\system32\inetsrv\appcmd and exposed this functionallity as a MSDeploy provider. appcmd is a commandline tool to configure iis, with it you can create apppools... If anyone's interested I could share some of the code...
Hi, another edit
I'm sorry it took me so long but I've put some of my code my custom AppPoolConfigProvider on my skydrive you can access it here
Or here is a gist repo to access it.
To use this provider, should place your compiled dll under an Extensibility folder (you have to create it yourself under "c:\Program Files (x86)\IIS\Microsoft Web Deploy V2\"). You can find more info about this online.
I use the provider in my xxx.wpp.targets file like this:
<Target Name="AddConfigAppPool" Condition="'$(RunConfigAppPool)'">
<Message Text="Adding configAppPool provider" />
<ItemGroup>
<MsDeploySourceManifest Include="configAppPool">
<path>@(__DefaultDeployEnvironmentSetting->'%(AppPoolName)')</path><!-- Represents the name of the AppPool, required-->
<managedRuntimeVersion>$(DeployManagedRuntimeVersion)</managedRuntimeVersion>
<managedPipelineMode>$(DeployManagedPipelineMode)</managedPipelineMode>
<processModel_identityType>@(__DefaultDeployEnvironmentSetting->'%(AppPoolIdentyType)')</processModel_identityType>
<processModel_userName>@(__DefaultDeployEnvironmentSetting->'%(AppPoolUserName)')</processModel_userName>
<processModel_password>@(__DefaultDeployEnvironmentSetting->'%(AppPoolUserPassword)')</processModel_password>
<processModel_idleTimeout>00:00:00</processModel_idleTimeout>
<AdditionalProviderSettings>managedRuntimeVersion;managedPipelineMode;processModel_identityType;processModel_userName;processModel_password;processModel_idleTimeout</AdditionalProviderSettings>
<!--Possible additional provider settings: queueLength,autoStart,enable32BitAppOnWin64,managedRuntimeVersion,managedRuntimeLoader,enableConfigurationOverride,managedPipelineMode,CLRConfigFile,passAnonymousToken,startMode,processModel_identityType,processModel_userName,processModel_password,processModel_loadUserProfile,processModel_logonType,processModel_manualGroupMembership,processModel_idleTimeout,processModel_maxProcesses,processModel_shutdownTimeLimit,processModel_startupTimeLimit,processModel_pingingEnabled,processModel_pingInterval,processModel_pingResponseTime,recycling_disallowOverlappingRotation,recycling_disallowRotationOnConfigChange,recycling_logEventOnRecycle,recycling_periodicRestart_memory,recycling_periodicRestart_privateMemory,recycling_periodicRestart_requests,recycling_periodicRestart_time,recycling_periodicRestart_schedule_[value='timespan']_value,failure_loadBalancerCapabilities,failure_orphanWorkerProcess,failure_orphanActionExe,failure_orphanActionParams,failure_rapidFailProtection,failure_rapidFailProtectionInterval,failure_rapidFailProtectionMaxCrashes,failure_autoShutdownExe,failure_autoShutdownParams,cpu_limit,cpu_action,cpu_resetInterval,cpu_smpAffinitized,cpu_smpProcessorAffinityMask,cpu_smpProcessorAffinityMask2-->
</MsDeploySourceManifest>
</ItemGroup>
I'm sorry I can't eleborate more on this, but it's been a while since I wrote this code and I simply do not have the time. You can find some info online about creating custom providers. If you have additional questions, I'll try to answer when I have time available.
Hope this helps
Best Answer
Assuming you have the correct IIS settings on your project and are running as Administrator, you should be able to specify
IncludeIisSettings=true
to have the settings included in the zip.If you need the actual AppPool definition included (so it can be created), you should also set
IncludeAppPool=true
.