By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,894 Members | 1,086 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,894 IT Pros & Developers. It's quick & easy.

Programmatically Recycling IIS Application Pools

P: n/a
Ram
Hey,
Is there a way to remotely Recycle IIS 6.0 Application Pools in .Net?
Thanks ahead

--Ram
Nov 16 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
to recycle using script see this
http://groups.google.ca/groups?q=rec...phx.gbl&rnum=1
for codebehind see this

void RestartApplicationPool(string applicationPoolName)
{
if (applicationPoolName == null)
{
throw new ArgumentNullException("applicationPoolName");
}

using (DirectoryEntry applicationPool = new
DirectoryEntry("IIS://localhost/W3SVC/AppPools/" + applicationPoolName))
{
applicationPool.Invoke("Recycle");
}
}

--
Regards,
Alvin Bruney

[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
------------------------------------------------------------

"Ram" <ni***@bezeqint.net> wrote in message
news:O7**************@TK2MSFTNGP09.phx.gbl...
Hey,
Is there a way to remotely Recycle IIS 6.0 Application Pools in .Net?
Thanks ahead

--Ram

Nov 16 '05 #2

P: n/a
Ram
Thanks alot!

Ram
"Alvin Bruney [ASP.NET MVP]" <www.lulu.com/owc> wrote in message
news:OB**************@TK2MSFTNGP15.phx.gbl...
to recycle using script see this
http://groups.google.ca/groups?q=rec...lm=OptknwINDHA
..3664%40tk2msftngp13.phx.gbl&rnum=1 for codebehind see this

void RestartApplicationPool(string applicationPoolName)
{
if (applicationPoolName == null)
{
throw new ArgumentNullException("applicationPoolName");
}

using (DirectoryEntry applicationPool = new
DirectoryEntry("IIS://localhost/W3SVC/AppPools/" + applicationPoolName))
{
applicationPool.Invoke("Recycle");
}
}

--
Regards,
Alvin Bruney

[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
------------------------------------------------------------

"Ram" <ni***@bezeqint.net> wrote in message
news:O7**************@TK2MSFTNGP09.phx.gbl...
Hey,
Is there a way to remotely Recycle IIS 6.0 Application Pools in .Net?
Thanks ahead

--Ram


Nov 16 '05 #3

P: n/a
Ram
Um...
Well I just tested the same code (the code you gave me earlier) on VS.NET
2003 and it didnt work!
When trying to bind the DirecforyEntry, I get:
"The Value Provided For adsObject Does Not Implement IADs"
While the SAME code works perfectly well on VS.NET 2005 - (Whiebey's
Beta)!!!
Please Help!

Ram
"Alvin Bruney [ASP.NET MVP]" <www.lulu.com/owc> wrote in message
news:OB**************@TK2MSFTNGP15.phx.gbl...
to recycle using script see this
http://groups.google.ca/groups?q=rec...lm=OptknwINDHA
..3664%40tk2msftngp13.phx.gbl&rnum=1 for codebehind see this

void RestartApplicationPool(string applicationPoolName)
{
if (applicationPoolName == null)
{
throw new ArgumentNullException("applicationPoolName");
}

using (DirectoryEntry applicationPool = new
DirectoryEntry("IIS://localhost/W3SVC/AppPools/" + applicationPoolName))
{
applicationPool.Invoke("Recycle");
}
}

--
Regards,
Alvin Bruney

[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
------------------------------------------------------------

"Ram" <ni***@bezeqint.net> wrote in message
news:O7**************@TK2MSFTNGP09.phx.gbl...
Hey,
Is there a way to remotely Recycle IIS 6.0 Application Pools in .Net?
Thanks ahead

--Ram


Nov 16 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.