If you want to let your web application restart your application pool, all you have to do is write a file to the IIS websites folder, which is typically c:inetpubwwwroot.
A file watcher on this folder restarts the application pool. It is advised that you don’t overuse this, as this will result in downtime for the end-user during the restart.