I deploy website through Teamcity using webdeploy method:
web.csproj /P:Configuration=%env.Configuraton% /P:DeployOnBuild=True /P:DeployTarget=MSDeployPublish /P:MsDeployServiceUrl=%env.DeployServiceUrl% /P:AllowUntrustedCertificate=True /P:MSDeployPublishMethod=WMSvc /P:CreatePackageOnPublish=True /P:UserName=%env.DeployUserName% /P:Password=%env.DeployPassword%
The error I recieve constantly:
[MSDeployPublish] VSMSDeploy (35s) [VSMSDeploy] C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.5\Web\Microsoft.Web.Publishing.targets(4196, 5): error ERROR_EXCEEDED_MAX_SITE_CONNECTIONS: Web deployment task failed. (The maximum number of connections for this site has been exceeded. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_EXCEEDED_MAX_SITE_CONNECTIONS.)
On Teamcity agent installed Visual Studio 2010 Express, .netf framework version: 4.0
I investigated the problem on the both ends: hosting web server and build machine( Visual Studio 2010 Express SP1 installed from web installer) from which I initiate deployment. Restart of the team city server and agents (problem reproduced on 2 agents) didn't help. I've installed team city agent on local machine and deployed successfully from it. Then I compared successful and failed build logs. The interesting part is the source of the error:
C:\Program Files(x86)\MSBuild\Microsoft\VisualStudio\v10.5\Web\Microsoft.Web.Publishing.targets
On my local machine (Visual Studio Ultimate 2010 with SP1) a have only
MSBuild\Microsoft\VisualStudio**v10**\Web\Microsoft.Web.Publishing.targets
so my quick solution was to test deployment using that method on build agents. I've replaced content of the
C:\Program Files(x86)\MSBuild\Microsoft\VisualStudio\v10.5\Web\
with
C:\Program Files(x86)\MSBuild\Microsoft\VisualStudio\v10\Web\
and that resolved the problem. I don't know why but deployment worked correctly on build agents previously.