On deploying cloud service, users sometimes receives alerts notifying WAS has not been started

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:

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

DISCLAIMER
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