Iis – How to get an email alert if IIS App pool stops/crashes

application-poolsemailiiswindows-server-2012windows-server-2016

I'm seeing a lot of PowerShell scripts out there which checks the status of the IIS App Pools in a server, and sends an email if it is in a Stopped state. Although the script is useful, it would need to be run at a frequent interval to check the App pool states. Is there a way to enable this monitoring in IIS level, such that an email is sent the instant an App pool is stopped? I'm using both Windows Server 2012 and 2016

Best Answer

An event should occurs when an App pool stops. Check this answers if it help: https://forums.iis.net/post/2143450.aspx

"As a workaround, you could try to go to Event Viewer->Custom Views->Server Roles->Web Server(IIS). Here is the logs for Web Server. While an application pool stopped, it will create a record with Event ID 5186. You could select a record and choose Attach Task To This Event and then in the action, you could send a mail alert."