在C#/Powershell中-是否可以更改IIS应用程序池的空闲超时? [英] in C#/Powershell - Is it possible to change the Idle TimeOut for an IIS Application Pool?

查看:187
本文介绍了在C#/Powershell中-是否可以更改IIS应用程序池的空闲超时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想禁用应用程序池的空闲超时(将其设置为零),并且想在安装时执行此操作,是否可以从C#或PowerShell中执行此操作?

I want to disable the idle timeout (Set it to Zero) of an application pool and I want to perform this at setup time, is it possible to perform this action from C# or PowerShell?

推荐答案

如果您使用的是PowerShell 2或更高版本,则应有权访问 WebAdministration 模块.

If you are using PowerShell 2 or later, you should have access to Set-ItemProperty. You'll also want to load the WebAdministration module.

然后您可以执行操作(示例取自此处)

You can then do (example taken from here)

Set-ItemProperty ("IIS:\AppPools\$name") -Name processModel.idleTimeout -value ( [TimeSpan]::FromMinutes(0))

并验证值是否已更改

Get-ItemProperty ("IIS:\AppPools\$name") -Name processModel.idleTimeout.value

这篇关于在C#/Powershell中-是否可以更改IIS应用程序池的空闲超时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆