7

在具有应用程序请求路由的 IIS 服务器上,可以通过右键单击服务器场 -> 创建服务器场来添加要路由到的新服务器场。

这将弹出一个对话框,可以在其中输入服务器场的设置。在 Create-Serverfarms 对话框中接受这些设置后,我没有设法找到编辑或查看这些设置的方法。

因此,我的问题是:如何在 create-serverfarm 对话框之外编辑服务器场的 target-url、http-port 和 https-port 设置?

4

1 回答 1

6

You could use the command line to do so.

For example, lets say we have a Server Farm called test with one application server www.example.com in it:

www.example.com

All the following commands need to be run in the %windir%\system32\inetsrv directory unless you have it in your PATH.
To change the target-url of the application server to www.google.com, use:

appcmd.exe set config /section:webFarms /"[name='test'].[address='www.example.com']".address:www.google.com

You can change any parameters the way you would do it with the dialog (and even more).
To get the list of parameters you can use with the command line:

appcmd.exe set config -section:webFarms -?

And particularly the section you seem to be interested by:

interesting settings

And finally, to view the current config of your server farm:

appcmd.exe list config /section:webFarms

Should get you something like:

config

References:

http://www.iis.net/learn/get-started/getting-started-with-iis/getting-started-with-appcmdexe

http://www.iis.net/learn/extensions/configuring-application-request-routing-(arr)/define-and-configure-an-application-request-routing-server-farm

Update:

You may generate PowerShell script from IIS Manager.

IIS Manager 1

IIS Manager 2

Web Server (IIS) Administration Cmdlets in Windows PowerShell

Also, you may edit C:\Windows\System32\inetsrv\config\applicationHost.config file manually.

于 2013-05-06T15:37:15.780 回答