'Recycle IIS App Pool from a different server using c#

Is it possible to recycle an IIS APP Pool using c# from a different server?

I can recycle the IIS App Pool if the App is inside the server but I want to trigger the recycle app pool from a different server.

Example:

  • Server A: App which has a button that connects to Server B then executes a Recycle App Pool.
  • Server B: Server that contains the main app that needs to be recycled after the button was pressed in Server A.


Solution 1:[1]

So I found this documentation that provides the remote connection to a different server which uses ServerManager.OpenRemote()

ServerManager.OpenRemote("<server name or IP address>")

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 jymskrl