开发者

Is it possible to use Powershell to make changes to Application Request Routing (ARR) in IIS7?

I'm working on some scripts to automate deployments. I use IIS7 ARR to load balance between two servers.

When doing a deployment I take one of the two out of load balancing and my powershell script deploys code to that server so I can test it before making it live.

It would be awesome if the script could also do the work of taking the server out of balance and putting it back in as it would save me having to open another remote de开发者_Go百科sktop connection :)

Is this possible? If so, anyone have any examples?


To enable ARR proxy using Powershell, just run the following...

Application Request Routing - Enable Proxy

 Set-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST'  -filter "system.webServer/proxy" -name "enabled" -value "True"

To modify ARR, just use Configuration Editor in IIS Manager and click Generate Script under the Actions menu.


I've successfully used this snippet to disabled caching on an ARR server farm:

Set-WebConfigurationProperty -Filter '/webFarms/webFarm[@name="MyServerFarm"]/applicationRequestRouting/protocol/cache' -Name enabled -Value $false

So in theory you could take a server out of the farm like this:

Set-WebConfigurationProperty -Filter '/webFarms/webFarm[@name="MyServerFarm"]/server[@address="server1.domain.com"]' -Name enabled -Value $false


Old post but all the ARR and rewrite stuff is configured via web/apphost.config so you can use the iis(8) config editor to make/view changes, and also generate scripts (generate script - on the left side, you need to make a change for it to become enabled)

This page on technet is also useful as a reference http://technet.microsoft.com/en-us/library/ee683953(v=ws.10).aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜