2009年2月24日 星期二

Windows Server 2003 - Windows Media Service and FTP

今天花了一些時間幫教資中心架設一台多媒體串流的伺服器,系統是 Windows Server 2003,並且要以 Windows Media Service 來提供影音串流的服務。

在 Windows Media Service 設定的部分非常的簡單,只需要以下步驟 :
  1. 新增/移除程式
  2. 管理 Windows 元件
  3. 勾選 Windows Media Service 並安裝
  4. 在程式集裡面啟動 Windows Media Service ,再設定幾下就好了。
接下來要提供 FTP 的服務,讓他們可以透過 FTP 來上傳影片到指定的資料夾下 ,過程也是很簡單,只要參照下面這個網址做就行了:
並且新增個使用者,開啟寫入權限等等。原本以為這樣就結束了,結果使用 FTP Client 軟體連線時,會卡在 Entering Passive Mode,然後出現 list error 等錯誤訊息。Google 了一下,原來是因為啟動了 Windows Firewall 導致 Passive Ports 無法存取而發生的錯誤。下面的網址有提供解決的方法 :
大致設定如下:

On Windows 2003 Server with IIS6
  • To Enable Direct Metabase Edit
    1. Open the IIS Microsoft Management Console (MMC).
    2. Right-click on the Local Computer node.
    3. Select Properties.
    4. Make sure the Enable Direct Metabase Edit checkbox is checked.
  • Configure PassivePortRange via ADSUTIL script
    1. Click Start, click Run, type cmd, and then click OK.
    2. Type cd Inetpub\AdminScripts and then press ENTER.
    3. Type the following command where the range is specified in "..". cscript.exe adsutil.vbs set /MSFTPSVC/PassivePortRange "5001-5201"
    4. Restart the FTP Publishing Service.
    You'll see the following output, when you configure via ADSUTIL script:

    Microsoft (R) Windows Script Host Version 5.6
    Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

    PassivePortRange : (STRING) "5001-5201"

  • Add each port to the Windows Firewall
    1. Click Start, click Control Panel, open Windows Firewall, and select the Exceptions tab.
    2. Click the Add Port button.
    3. Enter a Name for the Exception and the first number in the port range.
    4. Click TCP if not already selected and click OK.
    5. Repeat for each port in the range - for large ranges see the end of the document.
    6. Enable the Windows Firewall on the General Tab.


因為要開啟的 Ports 非常的多,所以它寫了一個小小的 Script 來開啟所有 Port :

To add a range of ports to Windows Firewall from the Command Line
  1. Click Start, click Run, type cmd, and then click OK.
  2. Type in the following where the range is specified in ( ) and the name of the firewall entry is in " ".
    FOR /L %I IN (5001,1,5201) DO netsh firewall add portopening TCP %I "Passive FTP"%I
  3. Each port in the range will be added with an "OK" confirmation.


你就看到一堆 Port 開啟的訊息出現了。最後再用 FTP Client 連線,順利完成 !

如果是使用 Windows Server 2000 的話 :

On Windows 2000 Server with IIS5 Configure PassivePortRange via Registry Editor
  1. Start Registry Editor (Regedt32.exe).
  2. Locate the following registry key: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Msftpsvc\Parameters\
  3. Add a value named "PassivePortRange" (without the quotation marks) of type REG_SZ.
  4. Close Registry Editor.
  5. Restart the FTP Publishing Service.
    Note: The range that FTP will validate is from 5001 to 65535.

沒有留言: