Problem: IIS fails to start, Throws the error : “The World Wide Web Publishing Service service depends on the Windows Process Activation Service service which failed to start because of the following error: The service has not been started.” in cloud service.
Symptom: w3wp service and WAS service crashes, after deployment of cloud service.
Resolution: It is a known issue and this may happen because an Internet Information Services (IIS)-based website may crash intermittently because a W3wp.exe process stops in Windows Server 2012 R2 when the operating system or an application tries to access a performance counter value during the shutdown process. This may cause system error events and prevent a graceful shutdown of the worker process.
This problem occurs because the memory that is allocated to the performance counter is already freed. One option to get rid of this issue is to install the Hotfix directly in your cloud service available here:
Or recommended way to install this to put this in your Start up task so it would be available each time when you redeploy your cloud service or it goes for auto scaling. Steps are given below
- Create a new folder of name StartUp in web role.
- Add following line of code in your service definition file inside your webrole tag.
<Startup> <Task commandLine="StartUp\startup.cmd" executionContext="elevated" taskType="simple"/> </Startup>
- Create a cmd file of name startup.cmd in StartUp folder.
- Right click on the above files added in StartUp folder, go to properties and set “Copy to output directory” as “Copy Always”.
- Download the hotfix file from the https://support.microsoft.com/en-in/kb/3048824 location and unzip the file and add the “1-KB3048824-v2-x64.msu” file in the Startup folder(As this file is in 1 MB in size, you can add this to your solution or If you don’t want to add this file in your solution then you can add this file to any shared location where it will be accessible to install).
- Add below command to your startup.cmd file:
set startuptasklog=.\startuptasklog.txt set regkey=HKLM\SOFTWARE\Microsoft set regkeyvalue=1 set regstring=SampleReg reg QUERY %regkey% /t REG_DWORD | Find "%regstring%" if %ERRORLEVEL%== 0 goto installed echo installing registry %regkey%\%regstring% >> %startuptasklog% REG ADD %regkey% /v %regstring% /t REG_DWORD /d %regkeyvalue% Startup\Windows8.1-KB3048824-v2-x64.msu /quiet if %ERRORLEVEL%== 0 ( echo successfully added registry %regkey%\%regstring% >> %startuptasklog% ) goto end :installed echo %regkey%\%regstring% is installed >> %startuptasklog% :end echo startup task finished >> %startuptasklog%
- Publish the Cloud Service
- You can also check the “SampleReg” registry at the location “HKLM\SOFTWARE\Microsoft”
- This task will restart your role first after installing this file on your machine. So it might take few minutes to start your instance.
If you will follow these steps it would help you to get rid of your issue if it matches with the problem described here.
To get to know more about this Please read https://support.microsoft.com/en-in/kb/3048824
It will give you complete Idea of it.
Sample Code/Script is provided for the purpose of illustration only and is not intended to be used in a production environment.
THIS SAMPLE CODE/Script AND ANY RELATED INFORMATION ARE PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object code form of the Sample Code,
provided that. You agree:
(i) to not use Our name, logo, or trademarks to market Your software product in which the Sample Code is embedded;
(ii) to include a valid copyright notice on Your software product in which the Sample Code is embedded; and
(iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, including attorneys’ fees, that arise or result from the use or distribution of the Sample Code