Using WinHTTP as a Side-by-side Assembly

来源:互联网 发布:linux tomcat内存溢出 编辑:程序博客网 时间:2024/06/15 01:30

Using WinHTTP as a Side-by-side Assembly

On Windows Server 2003, WinHTTP is implemented as a side-by-side assembly, and must be linked to as such. Note that this does not apply to Windows Vista and later.

Side-by-side Assemblies

Starting with Microsoft Windows XP, a side-by-side assemblies mechanism was provided to control run-time linking to avoid dynamic-link-library (DLL) versioning conflicts. For information about side-by-side assemblies, seeAbout Isolated Applications and Side-by-side Assemblies.

从XP开始,微软就开始实施肩并肩装配机制,这样可以控制因DLL版本冲突引起的动态连接。详情参见About Isolated Applications and Side-by-side Assemblies.

To use this mechanism to link to WinHTTP version 5.1 on Windows Server 2003, an application must incorporate a manifest that specifies WinHTTP as a dependent assembly. SeeUsing Side-by-side Assemblies for more information about how to do this.

要在WinHTTP5.1版的Windows Server 2003服务器上实现这种机制,程序包含一个manifest文件,并在其中指定WinHTTP作为第三方组件。具体怎么做参见Using Side-by-side Assemblies


WinHTTP 程序的Manifest例子

The sample manifest below illustrates an application manifest that can be used for linking to WinHTTP.

下面的manifest文件展示了manifet如何链接到WinHTTP中

All attributes except "type" of the "<assembly><assemblyIdentity>" must be modified as appropriate for your particular application. The same goes for the contents of the "<description>" element.

必须更改除了"type" of the "<assembly><assemblyIdentity>"的所有类型为你的程序。一直到"<description>"元素。

In addition, make sure that the "processorArchitecture" attribute of the "<dependentAssembly><assemblyIdentity>" matches the "processorArchitecture" attribute of the "<assembly><assemblyIdentity>". Below, for example, both are set to "x86".

另外要确保"<dependentAssembly><assemblyIdentity>""中"processorArchitecture的和"<assembly><assemblyIdentity>"属性中的"processorArchitecture匹配,下面例子中,这两项都设成了“x86”

All values not specific to your application should take the forms shown below.

你的应用中的所有特定值都应按下表设置。

<?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>
0 0