How to limit webdeploy connection number, ERROR_EXCEEDED_MAX_SITE_CONNECTIONS
Asked Answered
N

2

1

I have a solution that has 10-20 web projects, and I am trying to use msbuild webdeploy to deploy them.

msbuild "mysolution.sln" /p:DeployOnBuild=true /p:PublishProfile="Debug"

However, I got this error in the middle of deploy:

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Microsoft.Web.Publishing.targets(4295,5): msdeploy error ERROR_EXCEEDED_MAX_SITE_CONNECTIONS: Web deployment task failed. (The maximum number of connections for this site has been exceeded.

In the log, before this error, a few projects were being deployed and files were updated. It seems that msbuild is trying to deploy as many as projects at the same time as possible, and exceeded the max connection number.

So how can I limit the connection number, is there an option in the publish profile?

Update - workaround

I have got a workaround from viet.hoang in Sitecore slack channel. It basically increases the max connection number on the server and/or retry attemps in the publish profile.

  1. Increase max connection number: go to the target server and add adding the following to the registry: [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\IIS Extensions\MSDeploy\3] "MaxSiteConnections"=dword:00000010. Then restart Web Management Service.
  2. Increase retry attempts: in the publish profile there is an option "RetryAttemptsForDeployment", add it and set the value to 20.

The workaround works, no more error in the deployment. But I am still hopeful that someone will be able to provide some insights and a proper solution that doesn't require registry modification and can throw other types of errors quickly without retry 20 times.

Nepenthe answered 19/6, 2017 at 14:58 Comment(0)
N
1

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

Nepenthe answered 6/3, 2018 at 21:32 Comment(0)
S
0

I had the same problem when host by web deploy from visual studio 2017. after researching through online i had come across a solution . please follow the link: https://youtu.be/nOonbx9FgJQ

Sergiosergipe answered 17/6, 2018 at 8:14 Comment(2)
Welcome to Stack Overflow! While links are great way of sharing knowledge, they won't really answer the question if they get broken in the future. Add to your answer the essential content of the link which answers the question. In case the content is too complex or too big to fit here, describe the general idea of the proposed solution. Remember to always keep a link reference to the original solution's website. See: How do I write a good answer?Aspiration
Restarting the web deploy service on the remote server is only helpful in situations that connections didn't close as expected. However, in the question's context, there are too many projects deployed concurrently creating too many connections at the same time, thus it will throw this error no matter how clean the service was. So the only proper way is to increase the max connection number and/or reduce the concurrent MSBuild processes.Nepenthe

© 2022 - 2024 — McMap. All rights reserved.