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.
- 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.
- 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.