Web Deploy with TeamCity failed with error ERROR_EXCEEDED_MAX_SITE_CONNECTIONS
Solution 1
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.
Solution 2
I have fixed this problem by restarting the Web Management Service
in Services.
Solution 3
I've also come across this approach to allow an unlimited number of connections:
1.) Add the following registry key:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\IIS Extensions\MSDeploy\3]
"MaxSiteConnections"=dword:00000000
2.) Restart Web Management Service
Reference: Nicolas_nguyen1's comment on this Microsoft document
Source: How to limit webdeploy connection number, ERROR_EXCEEDED_MAX_SITE_CONNECTIONS
UPDATE
I was able to test this myself and it seemed like Web Deploy treated this value as literally "0" connections allowed, which resulted in this error occurring every time. So I set it to 0x7FFFFFFF
(maximum for a 32 bit integer).
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\IIS Extensions\MSDeploy\3]
"MaxSiteConnections"=dword:7FFFFFFF
Related videos on Youtube
Yevgen Safronov
Updated on June 04, 2022Comments
-
Yevgen Safronov almost 2 years
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
-
deniz over 8 yearsThis solution also worked for me on the error "Invoke build failed due to exception 'There is a build already in progress. Please try again later.'"
-
youen almost 8 yearsOn a French server, look for "Service de gestion Web" (don't know why they translate this kind of stuff, it's more complicated to apply existing solutions)
-
John Rocha about 7 yearsThis isn't a fix/solution. It's a work around. It'll also work if we reboot the server, but that's also not a fix/solution.
-
Mike almost 6 yearsWhen I tried this the Web Management Service hung and would not shut down.
-
Ian Warburton over 5 yearsWeb Management Service hung so I killed the process, it automatically restarted and the problem went away.