共用方式為


使用 WinHTTP 作為併行元件

在 Windows Server 2003 上,WinHTTP 以 side-by-side 組件的形式實作,且必須依此形式進行連結。 請注意,這不適用於 Windows Vista 和更新版本。

並列組件

從 Microsoft Windows XP 開始,已提供並存元件機制來控制運行時間連結,以避免動態連結庫 (DLL) 版本設定衝突。 如需並存元件的相關信息,請參閱 關於隔離的應用程式和並存元件

若要使用此機制連結至 Windows Server 2003 上的 WinHTTP 5.1 版,應用程式必須納入將 WinHTTP 指定為相依元件的指令清單。 如需有關如何完成此作業的詳細資訊,請參閱 使用並存元件

範例 WinHTTP 應用程式指令清單

下列範例指令清單說明可用來連結至 WinHTTP 的應用程式指令清單。

除了“<元件><assemblyIdentity>”的“type”屬性外,所有屬性都必須根據您的特定應用程式進行修改。 “<description>” 元素的內容也是如此。

此外,請確保“<dependentAssembly><assemblyIdentity>” 的 “processorArchitecture” 屬性符合 “<assembly><assemblyIdentity>” 的 “processorArchitecture” 屬性。 例如,以下兩者都設定為 「x86」。

不屬於應用程式專屬的所有值都應該採用如下所示的格式。

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <assemblyIdentity
                    version="1.0.0.0"
                    processorArchitecture="x86"
                    name="Microsoft.Windows.Sample"
                    type="win32" />
  <description>Sample WinHttp Application</description>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity 
                    type="win32" 
                    name="Microsoft.Windows.WinHTTP" 
                    version="5.1.0.0"
                    processorArchitecture="x86" 
                    publicKeyToken="6595b64144ccf1df"
                    language="*" />
    </dependentAssembly>
  </dependency>
</assembly>