【问题标题】:IIS 6.0 64-bit: SysInterals Proc Explorer showing 32-bit DLLs loaded?IIS 6.0 64 位:SysInternals Process Explorer 显示加载的 32 位 DLL?
【发布时间】:2011-12-11 06:00:25
【问题描述】:

试图确定一个问题,该问题很可能是由于我们的 Web 应用程序在 IIS 以 64 位运行时尝试加载 32 位版本的 OracleAccess.dll(它看起来像 32 位和 64 位版本的 Oracle 驱动程序可以并行安装)。

我在服务器上有两个站点,一个用于生产,一个用于测试。生产版本的代码由不再与我们在一起的员工部署。该网站有效。我们刚刚部署的另一个站点;它是为 Any CPU 编译的,我们在加载 Oracle 驱动程序时遇到错误。

如果我在 SysInternal 的进程资源管理器中查看生产站点的 IIS 工作进程,突出显示 IIS 工作进程,并在下部窗格视图中查看加载的 DLL,我会看到一些奇怪的数据。

工作进程的信息:

Process   Version        User Name                     PID   Image Type
w3wp.exe  6.0.3790.3959  NT AUTHORITY\NETWORK SERVICE  3320  64-bit 

但是在加载的DLL列表中,有的被列为64位图像,有的被列为32位?将 32 位 DLL 加载到 64 位进程空间中是不可能的(AFAIK),所以我可能不理解我看到的报告。

DLL 句柄信息的子集:

Name                Image Type   Description                          Company Name            Version         
aspnet_filter.dll   64-bit       Microsoft ASP.NET ISAPI Filter DLL   Microsoft Corporation   4.0.30319.1     
admwprox.dll        64-bit       IIS Admin Com API Proxy dll          Microsoft Corporation   6.0.3790.3959
adsldp.dll          64-bit       ADs LDAP Provider DLL                Microsoft Corporation   5.2.3790.3959
adsldpc.dll         64-bit       ADs LDAP Provider C DLL              Microsoft Corporation   5.2.3790.3959
advapi32.dll        64-bit       Advanced Windows 32 Base API         Microsoft Corporation   5.2.3790.4555
aspnet_filter.dll   64-bit       Microsoft ASP.NET ISAPI Filter DLL   Microsoft Corporation   4.0.30319.1
aspnet_isapi.dll    64-bit       Microsoft ASP.NET ISAPI Shim DLL     Microsoft Corporation   2.0.50727.3053
comctl32.dll        64-bit       Common Controls Library              Microsoft Corporation   5.82.3790.4770
comctl32.dll        64-bit       User Experience Controls Library     Microsoft Corporation   6.0.3790.4770
comres.dll          64-bit       COM+ Resources                       Microsoft Corporation   2001.12.4720.3959

    (Next few are our DLLs)

CSA.Database.DLL             32-bit       CSA.Database                         TE                      1.7.8221.0
CSA.Database.DLL             32-bit       CSA.Database                         TE                      1.7.8221.0
CSA.Loggers.DLL              32-bit       CSA.Loggers                          TE                      1.7.8221.0
CSA.Loggers.DLL              32-bit       CSA.Loggers                          TE                      1.7.8221.0
CSA.Network.DLL              32-bit       CSA.Network                          TE                      1.7.8221.0
CSA.Network.DLL              32-bit       CSA.Network                          TE                      1.7.8221.0
Enterprise.Data.DLL          32-bit       Enterprise.Data                      TE                      2.35.3.0
Enterprise.Data.DLL          32-bit       Enterprise.Data                      TE                      2.35.3.0
Enterprise.Diagnostics.DLL   32-bit       Enterprise.Diagnostics          TE                      2.35.3.0
Enterprise.Diagnostics.DLL   32-bit       Enterprise.Diagnostics          TE                      2.35.3.0

    (More Microsoft DLLs... some 32-bit, some 64-bit??)

FederatedLibrary.DLL   32-bit   FederatedLibrary   Microsoft   1.0.0.0
FederatedLibrary.DLL   32-bit   FederatedLibrary   Microsoft   1.0.0.0
gdi32.dll              64-bit   GDI Client DLL     Microsoft Corporation   5.2.3790.4396
gzip.dll               64-bit   GZIP Compressn DLL Microsoft Corporation   6.0.3790.1830

Microsoft.Practices.EnterpriseLibrary.Common.DLL   32-bit   Enterprise Library Shared Library   Microsoft Corporation   4.1.0.0
Microsoft.Practices.EnterpriseLibrary.Common.DLL   32-bit   Enterprise Library Shared Library   Microsoft Corporation   4.1.0.0
Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.DLL   32-bit   Enterprise Library Exception Handling Application Block   Microsoft Corporation   4.1.0.0
Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.DLL   32-bit   Enterprise Library Exception Handling Application Block   Microsoft Corporation   4.1.0.0
Microsoft.Practices.EnterpriseLibrary.Logging.DLL  32-bit   Enterprise Library Logging Application Block   Microsoft Corporation   4.1.0.0
Microsoft.Practices.EnterpriseLibrary.Logging.DLL  32-bit   Enterprise Library Logging Application Block   Microsoft Corporation   4.1.0.0

    (And finally, the Oracle drivers that seem to be causing issue... 64-bit)

oracle.dataaccess.dll   64-bit   Oracle.DataAccess.dll   Oracle Corporation   2.112.1.0
oracle.dataaccess.dll   64-bit   Oracle.DataAccess.dll   Oracle Corporation   2.112.1.0

我使用corflags 来查看工作的生产 DLL 是否被显式编译为 32 位...如果我理解输出,它们不是。

C:\SingleSignOn\bin>corflags CSA.Network.dll
Microsoft (R) .NET Framework CorFlags Conversion Tool.  Version  4.0.30319.1
Copyright (c) Microsoft Corporation.  All rights reserved.

Version   : v2.0.50727
CLR Header: 2.5
PE        : PE32
CorFlags  : 1
ILONLY    : 1
32BIT     : 0
Signed    : 0


了解为什么我们新编译的部署不起作用的第一步是了解为什么当前的部署起作用。谁能给我解释一下我看到了什么?

我需要知道的:

  1. IIS 是否作为 64 位进程运行,是否会将 Any CPU DLL 加载为 64 位?
  2. 如果是,为什么 Process Explorer 将这些 DLL 列为 32 位图像?
  3. IIS 是否可以将 32 位 DLL 加载到 64 位进程空间中?
  4. 如果 IIS 是 64 位进程,并且我们加载编译为 Any CPU 的网站,如果它所依赖的任何 DLL 是 32 位 DLL(例如,它是针对 32 -bit 版本的 Oracle 驱动程序?)

提前谢谢...

【问题讨论】:

    标签: c# iis compiler-construction iis-6 32bit-64bit


    【解决方案1】:

    Process Explorer 只是将 AnyCPU DLL 报告为 32 位。包含此信息的 PE 标头中的插槽没有针对 AnyCPU 的设置,因此编译器将它们标记为 32 位。但请放心,64 位进程只会加载 64 位 DLL,或者它强制进入 64 位模式的 AnyCPU DLL。

    本机 DLL、comctl32、gdi32 被标记为 64 位,这证明您的进程和其中的所有代码都以 64 位运行。只是 AnyCPU DLL 具有误导性。

    【讨论】:

    • 谢谢,大卫,这解释了它......我可以看到所有列为 32 位的 Microsoft DLL 都是 .NET DLL(不确定 FederatedLibrary.dll,但我我确定是)。现在我只需要弄清楚它试图加载的不是 64 位的:)
    【解决方案2】:

    在您的应用程序池中,将启用 32 位应用程序设置为 true 以强制您的应用程序为 32 位。

    如果应用程序池设置为 32 位模式,您的应用程序的 dll 可以标记为任何 CPU,并且将被加载到 32 位进程中。

    对于 IIS 6.0,您可能需要按照此处的说明进行操作 http://extended64.com/blogs/rhoffman/archive/2005/05/10/482.aspx

    cscript %SystemDrive%\inetpub\AdminScripts\adsutil.vbs 设置 w3svc/AppPools/Enable32bitAppOnWin64 1

    根据安装的 Oracle 驱动程序,您可以强制加载正确的驱动程序。即

     <runtime>
            <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
                <dependentAssembly>
                    <assemblyIdentity name="Oracle.DataAccess" publicKeyToken="89B483F429C47342" culture="neutral" processorArchitecture="amd64"/>
                    <bindingRedirect oldVersion="0.0.0.0-10.2.0.100" newVersion="2.112.1.0"/>
                </dependentAssembly>
                <dependentAssembly>
                    <assemblyIdentity name="Oracle.DataAccess" publicKeyToken="89B483F429C47342" culture="neutral"/>
                    <bindingRedirect oldVersion="0.0.0.0-10.2.0.100" newVersion="10.2.0.100"/>
                </dependentAssembly>
            </assemblyBinding>
        </runtime>
    

    【讨论】:

    • 实际上我以前做过,不是在这台服务器上,而是在其他地方。不幸的是,对于 IIS 6.0,这是一个 IIS 级别的设置,而不是 IIS 7 中的应用程序池设置,我无法影响在该服务器上运行的其他站点。不过建议很好,谢谢
    • 另一个选择是尝试强制 64 位 Oracle 驱动程序通过 web.config 中的 assemblyBinding 加载。
    • 奇怪的是,对于生产实例,它正在加载 64 位 Oracle 驱动程序......所以我不确定为什么它不会在测试中。要做一些融合测试,看看实际发生了什么。谢谢!
    猜你喜欢
    • 2012-08-06
    • 1970-01-01
    • 2018-05-29
    • 2011-08-12
    • 2014-08-10
    • 2013-03-02
    • 2017-07-10
    • 2022-01-20
    • 2011-05-12
    相关资源
    最近更新 更多