How do I reset IIS programmatically? -
What IIS is no substitute for the Administrative UI which can be used to reset the IIS of a program? ..
Now we have created a batch file, if iis reset and is scheduled every hour ......
I just wanted something so that we reset the IIS may not be able to ....
using WMI interface, you can recycle program Aeppul can
use MgmtClassGen in SDK to generate your WMI class:
"C: \ program files \ Microsoft visual Studio 8 \ SDK \ v2. 0 \ bin \ mgmtclassgen "IIsApplicationPool / n Root \ MicrosoftIISv2 / l VB / p IIsApplicationPool.vb -or -
"C: \ Program Files \ Microsoft Visual Studio 8 \ SDK \ v2 0.0 \ bin \ mgmtclassgen "IIsApplicationPool / N root \ MicrosoftIISv2 / l CS / p IIsApplicationPool.cs then use it in your code:
Try dim msScope the new Mandnspsht ( "root \ MicrosoftIISv2") IIsApplicationPool as dim wmiIISAppPool as to wmiIISAppPool = new IIsApplicationPool (msScope, String.Format ( "W3SVC / AppPools / {0}", _AppPoolID)) to recycle it WmiIISAppPool.Recycle () Exception logage ("*** ERROR - AppPoolRecycle failed: AppPoolID: {0} {1}", _App PoolID, ex.Message) Finally if not wmiIISAppPool is nothing then try wmiIISAppPool.Dispose () end
Comments
Post a Comment