SymProxy 自動安裝

下列步驟以及下列 Install.cmd 腳本可協助將 SymProxy 安裝自動化到預設 IIS 安裝。 您可能需要調整這些步驟,以符合您環境的特定需求。

  1. 建立 D:\SymStore\Symbols 資料夾。

    • 將讀取權授與所有人

    • 授與 SymProxy 應用程式集區使用者帳戶的讀取\寫入 (網域\使用者)

  2. 將 D:\SymStore\Symbols 共用為符號。

    • 授與讀取給所有人 (或更具體)
  3. (選擇性地) 在 D:\SymStore\Symbols 中建立名為 index2.txt的空白檔案。

  4. (選擇性地) 建立名為 %WINDIR%\system32\inetsrv\symsrv.yes 的空白檔案。 這會接受 Microsoft 公用符號存放區的 EULA。

  5. 判斷 Install.cmd 的參數並加以執行。

  6. 使用您所建立的伺服器名稱來設定用戶端符號路徑。

    SRV*\\MachineName\Symbols*https://MachineName/Symbols
    

Install.cmd 腳本需要 3 個參數:

  • 虛擬目錄路徑 (例如 D:\SymStore\Symbols )
  • 應用程式集區) 的使用者名稱 (
  • 應用程式集區) 的密碼 (

若要清除 MIME 類型繼承,需要 XML 檔案才能驅動相關聯的AppCmd.exe命令。 將如下所示的staticContentClear.xml檔案放在與 Install.cmd 腳本相同的資料夾中,以達成此結果。

範例 Install.Cmd 參數使用方式:

Install.cmd D:\SymStore\Symbols CONTOSO\SymProxyService Pa$$word

Install.cmd

@echo off

SET VirDirectory=%1
SET UserName=%2
SET Password=%3

::
::  SymProxy dll installation. 
::

copy symproxy.dll %windir%\system32\inetsrv
copy symproxy.man %windir%\system32\inetsrv
copy symsrv.dll %windir%\system32\inetsrv

lodctr.exe /m:%windir%\system32\inetsrv\symproxy.man
wevtutil.exe install-manifest %windir%\System32\inetsrv\symproxy.man
regedit.exe /s symproxy.reg

::
::  Web server Configuraiton
::

IF not exist %VirDirectory% mkdir %VirDirectory%

rem Make the 'Default Web Site'
%windir%\system32\inetsrv\appcmd.exe add site -site.name:"Default Web Site" -bindings:"http/*:80:" -physicalPath:C:\inetpub\wwwroot

rem Enabled Directory Browsing on the 'Default Web Site'
%windir%\system32\inetsrv\appcmd.exe set config "Default Web Site" -section:system.webServer/directoryBrowse /enabled:"True"

rem Make the 'SymProxy App Pool'
%windir%\system32\inetsrv\appcmd.exe add apppool -apppool.name:SymProxyAppPool -managedRuntimeVersion:
%windir%\system32\inetsrv\appcmd.exe set apppool -apppool.name:SymProxyAppPool -processModel.identityType:SpecificUser -processModel.userName:%UserName% -processModel.password:%Password% 

rem Make the 'Symbols' Virtual Directory and assign the 'SymProxy App Pool'
%windir%\system32\inetsrv\appcmd.exe add app -site.name:"Default Web Site" -path:/Symbols -physicalpath:%VirDirectory%
%windir%\system32\inetsrv\appcmd.exe set app -app.name:"Default Web Site/Symbols" -applicationPool:SymProxyAppPool

rem Disable 'web.config' for folders under virtual directories in the 'Default Web Site'
%windir%\system32\inetsrv\appcmd.exe set config -section:system.applicationHost/sites "/[name='Default Web Site'].virtualDirectoryDefaults.allowSubDirConfig:false

rem Add the 'SymProxy ISAPI Filter'
%windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/isapiFilters /+"[name='SymProxy',path='%windir%\system32\inetsrv\SymProxy.dll',enabled='True']

rem Clear the MIME Types on the 'Default Web Site'
%windir%\system32\inetsrv\appcmd.exe set config -in "Default Web Site" < staticContentClear.xml

rem Add * to the MIME Types of the 'Default Web Site'
%windir%\system32\inetsrv\appcmd.exe set config "Default Web Site" -section:staticContent /+"[fileExtension='.*',mimeType='application/octet-stream']"

staticContentClear.xml

<?xml version="1.0" encoding="UTF-8"?>
<appcmd>
    <CONFIG CONFIG.SECTION="system.webServer/staticContent"                  path="MACHINE/WEBROOT/APPHOST">
        <system.webServer-staticContent>
            <clear />
        </system.webServer-staticContent>
    </CONFIG>
</appcmd>    

測試 SymProxy 安裝

系統現在應該已準備好取得及提供檔案。 若要進行測試,請從執行 iisreset.exe 重新開機 IISAdmin 服務開始。 這會使用目前的 IIS 和 SymProxy 組態重載 ISAPI 篩選器。

設定偵錯工具以使用此符號路徑:

srv*\\MachineName\Symbols*https://MachineName/Symbols

如果啟用 MissTimeout (預設會設定為 300 秒,) ,則執行 .reload /f 命令兩次應該會導致第二次執行速度較快。

若要檢視所參考 PDB 的位置,請使用 lm (list modules) 命令。 PDB 的路徑應該全部以 \\MachineName\Symbols 開頭。

如果網站上已啟用瀏覽目錄,請流覽至 以查看 https://MachineName/Symbols 快取的檔案。

開啟效能監視器並檢視符號 Proxy 計數器。

開啟事件檢視器並檢視 Microsoft\Windows\SymProxy 事件。

另請參閱

安裝 SymProxy