Web Deploy with TeamCity failed with error ERROR_EXCEEDED_MAX_SITE_CONNECTIONS
Asked Answered
D

5

18

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

Depression answered 15/8, 2013 at 7:58 Comment(1)
Just to add my 2 cents: I retried and it worked. Sometimes cosmic rays just interfere.Koy
D
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.

Depression answered 15/8, 2013 at 10:30 Comment(0)
C
25

I have fixed this problem by restarting the Web Management Service in Services.

Crowson answered 18/2, 2015 at 7:52 Comment(5)
This 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.'"Puffer
On 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)Tropous
This 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.Saddler
When I tried this the Web Management Service hung and would not shut down.Sept
Web Management Service hung so I killed the process, it automatically restarted and the problem went away.Sirree
R
2

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
Resuscitate answered 12/3, 2018 at 7:20 Comment(0)
D
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.

Depression answered 15/8, 2013 at 10:30 Comment(0)
G
0

I had this same issue today on a new TeamCity build I was setting up. Builds are using Web Deploy to publish two MVC4 applications to test servers on the local network on a nightly schedule.

In my case, the error was due to having the "Trigger build on all enabled and compatible agents" option checked on the build's Schedule Trigger in TeamCity. We have four build agents and having that option checked was starting four builds at the same time. Two of the builds succeeded and two failed with the ERROR_EXCEEDED_MAX_SITE_CONNECTIONS error.

Grimona answered 22/8, 2014 at 15:0 Comment(0)
P
0

I have also encountered this error and I researched two ways to solve it. This is my original question, but I think this question is more easily searchable than mine, so I will repost my findings here to help others: https://mcmap.net/q/740731/-how-to-limit-webdeploy-connection-number-error_exceeded_max_site_connections

Method 1 - Limit connection via MSBuild

There is a way to limit how many thread MSBuild can use.

msbuild.exe mysln.sln /maxcpucount:3  

The "maxcpucount" limits the MSBuild threads, thus limit how many projects can be published at the same time. If it is not defined, MSBuild will actually use up to the number of processors on the computer.

Reference: https://msdn.microsoft.com/en-us/library/bb651793.aspx

Method 2 - Lift limit on the server

Add a registry value to the server

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\IIS Extensions\MSDeploy\3]

"MaxSiteConnections" (DWORD Value) : 0

Then restart "Web Management Service".

When you set the registry value to 0, it means unlimited connection.

Reference: Nicolas_nguyen1's comment in this Microsoft document

Paulo answered 12/3, 2018 at 16:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.