问题
I'm using MSBuild to build and deploy the website, Before deploying i need to recycle the Application Pool, How can i do this from msbuild script? (I do not want to restart the IIS just recycle the application pool)
回答1:
Why don't you use the extension pack: http://www.msbuildextensionpack.com/help/4.0.4.0/index.html
It has a task:
<MSBuild.ExtensionPack.Web.Iis7AppPool TaskAction="Recycle" Name="MyAppP"/>
That should do what you ask.
回答2:
The command is
c:\Windows\system32\inetsrv\appcmd.exe recycle apppool "MyAppPool"
You can execute it within msbuild target using <Exec> task.
来源:https://stackoverflow.com/questions/8556139/recyling-apppool-using-msbuild-script