Web Deploy Fails with ERROR_EXCEEDED_MAX_SITE_CONNECTIONS - azure

When I deploy my solution (DNN solution) from Visual Studio using Web Deploy, I get success for a few files (averaging 30) then I get the error:
Error 102 Web deployment task failed. (The maximum number of connections for this site has been exceeded. Learn more at: h**p://go.microsoft.com/fwlink/?LinkId=221672#ERROR_EXCEEDED_MAX_SITE_CONNECTIONS.) 0 0 h**p://mylocalhostwebsite/mywebsitename/"
I read everything I could get on the and was not able to find a solution that works.
I run my own dedicated server on Windows 2012 (on windows azure). My dev environment runs on Windows 8, and I am deploying using VS.NET 2013 Ultimate
The server is clean, has only one website and it's not even life (no one is hitting the server except me, the one and only developer)
Once this error occurs, web deploy would fail with the same error continuously (no more 30 files or so)...all up until I restart the server.
I check the web server, and all seems to be intact...
I am not deploying the database as part of the process

I had the same problem with an IIS in Windows Server 2012 R2.
I've solved it using this post
UPDATE
Go to the IIS Server
Select your IIS Server, in the Features View, select Management Service
Under Actions, click Restart.
So I've restarted the server and worked fine...

I tried searching everywhere for why this was happening, but am yet to find an answer. When it happened, the quickest way to be able to publish again was to kill the WMSVC process and start it again. To reduce having to do this manually, I kill the WMSVC process everyday at midnight, using a batch file and Windows Task Scheduler.
ECHO OFF
for /f "tokens=2 delims=," %%B in ('tasklist /fi "Imagename eq wmsvc.exe" /fo csv') do #echo %%B >processkill.txt
set /p taskid=<processkill.txt
TASKKILL /f /pid %taskid%
exit
This creates a text file in the same location as the batch file you're running with the process ID of the WMSVC process, and then kills it. Make sure to have the process set to automatic start.
Furthermore, I am investigating whether this will be a more permanent fix - adding the following to the registry:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\IIS Extensions\MSDeploy\3]
"MaxSiteConnections"=dword:00000010

Related

dnx holding locks on files IIS - unable to copy over

We have an ASPNet5 site (angular site and webapi service) running under IIS 8.5 successfully. The issue we have now run into is dnx holding locks on files that prevent us from re-deploying the site from our automated deployment server. The task is simply using robocopy to perform the task but I can reproduce with a simple copy as well. Essentially, the error is "process cannot access the file xxxx because it is being used". The files in question are mostly under the approot/packages dir.
The question is how to work around this. The main goal being able to re-deploy without having to bring down the site which seems impractical.
We are running on Win2012R2, IIS8.5 and clr rc1-update1.
Thanks for your help in advance.

msdeploy failure: IIS 7.5->8.5: Error: The ApplicationHost.config file is invalid / eventlog error 9000 on destination system

Using v7.1 (that is the ver at cmd prompt), 3.6 (from web platform installer) of msdeploy.exe
Migrating from Win2008-R2 IIS to Win2012-R2
Attempting to move everything IIS related over. (And yes, we have customized applicatiohost.config, but we do not know all the mods... that is why we are using a migration tool,,, to move everything...)
Command I am running:
C:\Program Files\IIS\Microsoft Web Deploy V3>msdeploy
-verb:sync -source:webserver,
computername=WIN-67E8GTGADGJ
-dest:webserver,computername=192.168.2.21,
userName="administrator",password="###"
output:
Info: Using ID '1d59e6bd-0f89-4479-9853-98e164c9f613' for connections to the rem
ote server.
Info: Using ID '0c99bd7f-faa3-4737-ac35-d65c495402b6' for connections to the rem
ote server.
Info: Adding MSDeploy.webServer (MSDeploy.webServer).
Info: Adding webServer (MSDeploy.webServer/webServer).
Info: Adding appHostConfig ().
Error: (8/24/2015 10:28:43 PM) An error occurred when the request was processed on the remote computer.
Error: The ApplicationHost.config file is invalid. Cannot proceed with synchronization.
Error count: 1.
MORE INFORMATION
The sequence of events is:
Target system logs one error event:
Microsoft-Windows-IIS-APPHOSTSVC -- message 9000
And then msdeploy on the source system throws (and msdeploy exits):
Error: (8/25/2015 4:36:50 PM) An error occurred when the request was processed on the remote computer.
Error: The ApplicationHost.config file is invalid. Cannot proceed with synchronization.
Error count: 1.
UPDATE: Initially I was getting TWO event log errors on target system. Message 9000 and 9012. I was able to fix the 9012 by extending the applicationhost.config file. But hours of work and no solution yet for the 9000 error.
I have examined the ApplicationHost.config, and compared it to baseline, and there really seems to be nothing special there.
What is the path to resolution?
The answer is that there seems to be real problems with msdeploy, but no one seems to understand (or document) why. The tool is primarily built to go from IIS 6.x (Win 2003) to newer IIS.
In our experience, when going from IIS 7.x to 8.x, you often cannot use msdeploy with "source:webserver" approach. However, msdeploy can do a lot of the lifting for you from 7.x to 8.x.
Here are some steps I have seen work:
First, do three steps. This will let msdeploy move as much as it can (would be nice if it could move more, but this is as far as I have seen work):
msdeploy -verbose -verb:sync -source:apphostconfig="WEB SITE NAME",computername=SOURCEMACHINE -dest:apphostconfig="WEB SITE NAME",computername=DESTINATIONMACHINE,userName="administrator",password="password-here" -enableLink:AppPoolExtension
Note the "enablelink" flag.
Repeat the above with:
-enableLink:CertificateExtension
and then
-enableLink:FrameworkConf
Once this is done, msdeploy has done all it can. You should now have the site migrated, with content and app pools, and ssl certs, and the configuration related to the sites and app pools.
For mime mappings, and other IIS system wide settings (compression is one example), you are on your own.
Don't ask me why there is no document on how to do this. (Don't ask me why msdeploy can't just do the whole freaking server. It works great from IIS 6, but not from IIS 7, like what kind of crazy is that? Anyway, send Satya an email about it.)

SharePoint 2007 WSP deployment process, restarting SPTimerV3 service

I've got a WF feature which I've been deploying into my development/test environment fairly frequently, and as such have run into an issue where the assembly seems to be cached by the SharePoint Timer service (SPTimerV3), and then an out-of-date version is used after the workflow rehydrates following a Delay Activity.
To fix this, I've tried adding a "NET STOP SPTimerV3" and "NET START SPTimerV3" to my batch file after the STSADM commands to install the .WSP . It works to restart the timer service, and I no longer have the caching problem, however restarting the timer this way seems to kill my SP App Pools in IIS fairly regularly.
Has anyone found a good way to restart the timer in a WSP deployment batch file without adverse affects? Do I need to restart another dependent service, or restart the App Pools each time as well?
you need to restart IIS as well. IISRESET /noforce should do the trick.

Set application pool with MSDeploy and TFS 2010

I'm trying to deploy website with MSDeploy and team build using some of this ...
/p:DeployOnBuild
/p:DeployTarget=MsDeployPublish
/p:CreatePackageOnPublish=True
/p:MSDeployPublishMethod=InProc
/p:MSDeployServiceURL=localhost
/p:DeployIISAppPath="Default Web Site"
Is there a way to set this website in custom application pool?
If you're using IIS 7, you can use the appPoolProvider to sync application pools to a remote server. See:
http://technet.microsoft.com/en-us/library/dd569070(WS.10).aspx
and
http://blog.torresdal.net/2010/08/16/NoClickWebDeploymentPart2WebDeployAkaMsdeploy.aspx
However, I wasn't able to really get that to work well, and if you're using IIS 6 this won't work anyway. What you can do though is leverage MSDeploy to run a couple commands on the remote server to set the application pool (and register the .NET version on the website).
First, create a batch file that contains something similar to the following:
cscript //nologo C:\Inetpub\AdminScripts\adsutil.vbs
SET w3svc/<IIS number>/Root/<virtual directory>/AppPoolid "<app pool name>"
So, if the IIS number is 1, your virtual directory is "MyDirectory" and the App Pool is named ".NET4.0", the command would be.
cscript //nologo C:\Inetpub\AdminScripts\adsutil.vbs
SET w3svc/1/Root/MyDirectory/AppPoolid ".NET4.0"
You can then run MSDeploy, passing this batch file in as an argument and running it on the remote machine:
MSDeploy
-verb:sync
-source:runCommand="<path to batch file>",waitinterval=5000
-dest:auto,computername=<computer name>
where <path to batch file> is the full path to the batch file you just created above, and is the computer against which you want to run this. Here is a link describing the runCommand argument: http://technet.microsoft.com/en-us/library/ee619740(WS.10).aspx
I'm sure you can set this up as a build step in TFS. We made a little .NET utility that we call as part of our deployment process that creates these batch files and runs the MSDeploy command.
There are also other things you can do in this same method that might prove useful to you:
Register an IIS version:
%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe
-s w3svc/1/root/MyDirectory
Create an App Pool:
CSCRIPT //nologo %dir%\adsutil.vbs
CREATE w3svc/AppPools/AppPoolName IISApplicationPool
Thanks to http://justsamson.com/2010/06/14/create-virtual-directory-in-iis-6-0-via-command-line/ for the command-line scripts to do the various functionality.
Part of the trick is with /p:IncludeAppPool=true. That changes the deploy script to enable AppPoolExtension. But I haven't figured out how best to actually set the app pool yet. :)

Script to check IIS running or not

I would like to write a script to start IIS server automatically if it is stopped.
You can use the IIS Admin Scripts to query the server, and then start it if you need.
The script is located in %systemroot%\system32.
To query you server, just run IIsWeb.vbs /query w3svc/1 from a command line.
If it's not running, then you can run IIsWeb.vbs /start w3svc/1 to start it.
Here is an article with more information on these scripts.
you can look for w3wp.exe in the process list (if it's IIS6)
you can always try "iisreset /start" - I believe, it works even if IIS is already started
take a look at the scripts provided by Microsoft in C:\Inetpub\AdminScripts (assuming default install location), there is startsrv.vbs, startweb.vbs - both do a good job
One simple thing you can do if you are worried about iis not restarting after it fails is to set the services responses. If you go into services and then look at the properties for iis, you will see a recovery tab. Change each of the failure options to restart the service. one thing you could also do is create a batch file that includes
iisreset
and set the option to run program and have that be the program you select.
Found some code here: https://social.msdn.microsoft.com/Forums/en-US/5a01d88b-2b7c-4d0b-bce0-9b90a236b64a/how-to-check-if-iis-is-running?forum=asmxandxml
Example:
Dim sc As New System.ServiceProcess.ServiceController("World Wide Web Publishing Service")
If sc.Status.Equals(System.ServiceProcess.ServiceControllerStatus.Stopped) Or sc.Status.Equals(System.ServiceProcess.ServiceControllerStatus.StopPending) Then
' Start the service if the current status is stopped.
sc.Start()
Else
' Stop the service if its status is not set to "Stopped".
sc.Stop()
End If

Resources