如何讓IIS只佔用指定IP

在 IIS 中的站台設定, 可以明確地指定單一站台的 IP及 PORT, 不過無論如何設定, 預設 IIS 就會在發起 SERVICE 時, 佔用 0.0.0.0 這個 IP (也就是全部的 IP), 若是希望 IIS 不要佔用這個 IP (也就是希望能和其他佔用 80 PORT 的 SERVICE, 如 APACHE 共同使用同一台主機的狀況下), 可以利用 Support Tools 內的 httpcfg 工具來進行操作, 詳細步驟如下:

1. Click Start, and then click Run.
2. Type cmd, and then click OK to open a command prompt.
3. Type the following, where xxx.xxx.x.x is the IP address you want to add:

httpcfg set iplisten -i xxx.xxx.x.x
When this succeeds, Httpcfg returns the following:
HttpSetServiceConfiguration completed with 0To view additional status codes, see the Httpcfg help.

4. After the IP address is added, use the following command to list it:

httpcfg query iplisten
Httpcfg returns the following:
IP :xxx.xxx.x.x

5. From the command prompt, stop the HTTP service and its dependent services. To do this, type the following string at the command prompt:

net stop http /y

6. From the command prompt, restart the HTTP service and it dependent services. To do this, type the following string at the command prompt:

net start w3svc
Note When you start w3svc, all services that were stopped when HTTP was stopped will start.

進行指定 IP 的操作後, 之後 IIS 就只會佔用指定的 IP, 而不會佔用全部的預設 IP 0.0.0.0 囉! 請參考微軟 KB 資料: http://support.microsoft.com/kb/813368

SQL Server釋放記憶體方式

若是 SQL Server 2005有突發性的記憶體不足的問題, 可能是一個 bug, 可以參考: http://support.microsoft.com/kb/912439 , 也有可能是記憶體配置的問題, 不過無論如何, 很有可能造成系統的重大負擔而其他服務或 terminal service無法工作, 有個比較快速的解決方式是先清除 server 內的記憶體快取的部分, 可以使用以下幾個指令來處理:

  1. DBCC FREESYSTEMCACHE : 可以參考: http://msdn.microsoft.com/en-us/library/ms178529.aspx
  2. DBCC FREESESSIONCACHE: 可以參考: http://msdn.microsoft.com/en-us/library/ms187781.aspx
  3. DBCC FREEPROCCACHE: 可以參考: http://msdn.microsoft.com/en-us/library/ms174283.aspx

這樣可以快速地爭取到一些 SQL Server釋放出來的記憶體, 並登入 SQL Server 主機進行操作或 reboot, 以降低對系統的傷害.

通常會發生這樣的狀況, 有些是因為記憶配置的問題, 也有 svchost.exe 在網路上使用過量的記憶體等狀況, 但無論如何, 能先爭取登入主機並進行一些急救處理, 以整理或釐清問題所在是相當重要的.

ps. 若要都用預設釋放的指令如下:

DBCC FREESYSTEMCACHE(‘ALL’)
DBCC FREESESSIONCACHE
DBCC FREEPROCCACHE WITH NO_INFOMSGS

可以很快地救急.