任何人都可以请告诉我如何使用asp.net 4.0热身机制的powershell脚本的IIS?如何使用powershell脚本进行asp.net 4.0的IIS热身?
我创建这个PowerShell脚本,但它似乎并没有写什么到applicationHost.config文件: (试图从这里执行第3步,但使用PowerShell:http://weblogs.asp.net/gunnarpeipman/archive/2010/01/31/asp-net-4-0-how-to-use-application-warm-up-class.aspx)
Import-Module WebAdministration
$SiteName="Default Web Site"
$ApplicationName=“WebOne“
Add-WebConfiguration "system.applicationHost/sites/site[@name='Default Web Site']/application[@path='WebOne']" -Value @{serviceAutoStartEnabled="true";serviceAutoStartProvider="PreWarmMyCache"} -PSPath IIS:\Sites\$SiteName\$ApplicationName -Location $SiteName/$ApplicationName
我想添加这两个(2)性能(serviceAutoStartEnabled="true" and serviceAutoStartProvider="PreWarmMyCache"):
如:
<application path="/" serviceAutoStartEnabled="true" serviceAutoStartProvider="PreWarmMyCache" />:
我目前申请ication路径:(从这里开始第4步,但使用PowerShell:http://weblogs.asp.net/gunnarpeipman/archive/2010/01/31/asp-net-4-0-how-to-use-application-warm-up-class.aspx) :
<sites>
<site name="Default Web Site" id="1">
<application path="/WebOne" applicationPool="ASP.NET v4.0">
<virtualDirectory path="/" physicalPath="C:\NetProjects\WebOne" />
</application>
</site>
</sites>
我还需要这PowerShell脚本
<serviceAutoStartProviders>
<add name="PreWarmMyCache" type="PreWarmCache, MyAssembly" />
</serviceAutoStartProviders>
任何帮助将大大appriciated.-
我已经powershell脚本这个东西下面也是需要的,但我需要上面的东西(serviceAutoStartEnabled =“true”和serviceAutoStartProvider =“PreWarmMyCache”),我提到的.-
#Load IIS Modules
Import-Module WebAdministration
if (Test-Path IIS:\AppPools\SosSWarmUpWorkerProcess)
{
#Let's delete the entry if it's already there (while deploying between versions)
Remove-Item IIS:\AppPools\SosSWarmUpWorkerProcess -Force -Recurse
}
$myNewPool = New-Item IIS:\AppPools\SosSWarmUpWorkerProcess
$myNewPool.managedRuntimeVersion = "4.0"
$myNewPool.startMode="AlwaysRunning"
$myNewPool | Set-Item