错误 ASP 0177:8007007e COM DLL 的 CreateObject 失败
Error ASP 0177: 8007007e CreateObject fails for COM DLL
我们一直在尝试在新服务器上安装 COM DLL。界面是经典 ASP。地图连接器 DLL 似乎是问题所在,但据我所知。
除了 500 错误之外,我们无法让 IIS 服务的页面给出任何错误。
追踪ASP时:
127. -ASP_SCRIPT_TRACE_COM_CALL_END
FilePath
C:\INETPUB\WWWROOT\MILER\GLOBAL.ASA
LineNumber
6
CurrentStatement
set g_pcmsrv=Server.CreateObject("PCMServer.PCMServer")
SizeOfStatement
55
0 ms
128. -ASP_LOG_ERROR
LineNumber
6
ErrorCode
ASP 0177 : 8007007e
Description
Server.CreateObject Failed
DLL 是 PCMSRV32.DLL
在 c:\windows
GLOBAL.ASA:
Sub Application_OnStart
set g_pcmsrv=Server.CreateObject("PCMServer.PCMServer")
set application("g_pcmsrv") = g_pcmsrv
set g_pcmmapmgr=Server.CreateObject("Pcmgole.PCMMapMgr")
set application("g_pcmmapmgr") = g_pcmmapmgr
End Sub
Sub Session_OnStart
set Session("currentTrip") = application("g_pcmsrv").NewTrip("NA")
set Session("map") = application("g_pcmmapmgr").createMap()
End Sub
Sub Session_OnEnd
set Session("currentTrip") = Nothing
set Session("map") = Nothing
End Sub
Sub Application_Onend
Set application("g_pcmsrv")=Nothing
Set application("g_pcmmapmgr")=Nothing
End Sub
以下建议涉及 Server.CreateObject
和 CreateObject
在
中的使用
Web 服务器部分是特定于 asp-classic 但仍然值得一读。
导致此错误的原因是什么?
Server.CreateObject Failed
最常见的情况是,当 Web 应用程序从一个 Web 服务器移动到另一个 Web 服务器时,不了解正在使用并向 Web 服务器注册的外部 COM 组件。
From PRB: Server.CreateObject Returns HTTP 500.100 or ASP 0177 Error (0x8007007E)
This error occurs when you attempt to use the Server.CreateObject method to instantiate an object that is not registered on the local system.
识别错误来源
如果您在 ASP Web 应用程序中使用 COM 组件,您将看到这样的一行
set g_pcmsrv=Server.CreateObject("PCMServer.PCMServer")
通常错误会指向 Set
行,这样可以更容易地确定原因 (幸运的是你有一些很好的跟踪代码,所以它更好)。
如果您不知道 DLL 的位置怎么办?
Note: Please be careful when accessing the Windows Registry as it is very easier to inadvertently make changes that have serious consequences for the Operating System and in extreme cases will require a system restore or re-install / repair.
CreateObject
方法中的字符串称为 ProgId
,用作 Windows 注册表中的键的标识符,可以在 [=82] 中找到=]
Note: Windows Registry can be browsed in most versions of Windows using the regedit.exe
also known as the Registry Editor. Be very careful when using this tool to browse the Windows Registry.
HKEY_CLASSES_ROOT
并推而广之
HKEY_LOCAL_MACHINE\Classes
每当 ASP 处理器遇到 ProgId
时,它会尝试与 Windows 注册表对话并找到表示已注册 COM 可访问 DLL 位置的相应键。
HKEY_CLASSES_ROOT\PCMServer.PCMServer
一个常见的方法是密钥包含一个名为 CLSID
的子项,它指向关联的已注册 DLL 的 Class GUID。一旦 GUID 密钥位于
HKEY_CLASSES_ROOT\CLSID
hive 可以通过查看子键来查找位置
HKEY_CLASSES_ROOT\CLSID\{GUID from CLSID}\InprocServer32
位置将存储在 (default)
值中。
Example Using the ProgId
- Scripting.FileSystemObject
Locate Scripting.FileSystemObject
subkey in HKEY_CLASSES_ROOT
HKEY_CLASSES_ROOT\Scripting.FilesystemObject
Identify GUID from subkey CLSID
HKEY_CLASSES_ROOT\Scripting.FilesystemObject\CLSID
(default) - "{0D43FE01-F093-11CF-8940-00A0C9054228}"
Use GUID to find registered DLL subkey in HKEY_CLASSES_ROOT\CLSID
HKEY_CLASSES_ROOT\CLSID\{0D43FE01-F093-11CF-8940-00A0C9054228}
Check subkey InprocServer32
(default)
value for the DLL location
HKEY_CLASSES_ROOT\CLSID\{0D43FE01-F093-11CF-8940-00A0C9054228}\InprocServer32
(default) - "C:\Windows\System32\scrrun.dll"
注册表中 PCMServer.PCMServer
没有 ProgId
?
如果您在注册表中找不到相应的 ProgId
,可能是由于我们将在此处详细说明的两个原因之一。
- DLL 未注册。
- DLL 注册在错误的区域。
如何使用 Windows
注册 COM DLL
COM DLL 可以通过 运行 在 Windows 命令提示符下使用提升的权限 使用 regsvr32.exe
工具注册并创建相应的注册表项(这Windows).
的版本因版本而异
在我们继续之前,虽然操作系统的体系结构和 ASP Web 应用程序使用的模式非常重要。
大多数较新的硬件都是 64 位的,这在 Windows 中造成了一个难题,因为它现在必须支持较新的 64 位架构并且仍然保持对 32 位架构的支持。 Microsoft 提出的解决方案是将 OS 一分为二,因此我们有 64 位元素和 32 位元素。主要 OS 程序分为两个文件夹 (仅在 64 位 OS 上,因为 32 位 OS 不必与 64 位竞争,即使硬件可以做到).
Note: On 32 Bit only systems just use the 64 Bit locations for both System Files and the Windows Registry.
在 64 位 OS 上,系统程序位于
对于 64 位程序
%SystemRoot%\System32\
对于 32 位程序
%SystemRoot%\SysWOW64\
这也适用于 Windows 注册表
64位
HKEY_CLASSES_ROOT
32位
HKEY_CLASSES_ROOT\Wow6432Node
例如,在 Windows 的 64 位版本上,以下命令将在 32 位注册表中注册 PCMSRV32.DLL
并创建关联的 COM DLL 注册表项。
C:\Windows\SysWOW64>regsvr32 "C:\Windows\PCMSRV32.DLL"
IIS 应用程序池
随着包括 IIS 在内的一切都开始支持 64 位,您仍然需要能够支持仅支持 32 位 COM 的遗留应用程序,因此在 IIS 6.0 中引入了 IIS (从 Windows 开始Server 2003,Service Pack 1) 在应用程序池下设置可配置的 属性 Enabled32BitAppOnWin64
,它允许应用程序池在 64 位版本的 运行 中以 32 位模式 Windows.
考虑到这一点,在您注册 COM DLL 以了解您应该在哪里注册它之前,您需要知道应用程序池是否 运行ning 在 32 位模式下。在 IIS 7.0 及更高版本中,您可以从 IIS 管理器应用程序内的应用程序池属性中检查它。该设置在 General
部分下的 Advanced Settings
中,称为 Enable 32-Bit Applications
(也可以在 applicationHost.config
中使用 enable32BitAppOnWin64
下的配置<ApplicationPools>
部分).
如果Enable 32-Bit Applications
设置为False
IIS 应用程序池 运行 以本机 64 位模式运行,ASP Web 应用程序需要使用的任何 COM DLL 都需要支持 64 位并使用regsvr32.exe
的 64 位版本将添加到 64 位注册表中。
C:\Windows\System32>regsvr32 "C:\Windows\PCMSRV32.DLL"
如果Enable 32-Bit Applications
设置为True
IIS 应用程序池 运行 正在 32 位模式下,ASP Web 应用程序需要使用的任何 COM DLL 都需要是 32 位 COM DLL,并使用要添加到 32 位注册表中的 regsvr32.exe
的 32 位版本。
C:\Windows\SysWOW64>regsvr32 "C:\Windows\PCMSRV32.DLL"
使用错误版本的 regsvr32.exe
注册 COM DLL
例如,使用
C:\Windows\SysWOW64>regsvr32 "C:\Windows\PCMSRV32.DLL"
当 IIS 应用程序池不是 32 位模式时,在 Windows 的 64 位版本上使用 32 位注册表注册 COM DLL 将导致 ASP 500.100
内部服务器错误
Server object error 'ASP 0177: 8007007e'
Server.CreateObject Failed
COM DLL 清单
什么是 IIS 应用程序池高级设置 Enable 32-Bit Applications
,因为它会影响您注册 COM DLL 的方式?
DLL 是否使用 regsvr32.exe
的体系结构特定版本注册(如果 Windows 版本不是 64 位,则使用默认值) 反映了 Enable 32-Bit Applications
?
的设置
Windows 注册表是否在
的体系结构特定位置包含 DLL 的 ProgId
HKEY_CLASSES_ROOT
反映了 Enable 32-Bit Applications
?
的设置
InprocServer32
密钥是否包含 DLL 的正确位置?
在我用来访问 COM DLL 的帐户上下文中 (ApplicationIdentity、LocalSystem、NetworkService 等),我是否有权访问物理 DLL 文件和注册表项?
有用的链接
我们一直在尝试在新服务器上安装 COM DLL。界面是经典 ASP。地图连接器 DLL 似乎是问题所在,但据我所知。
除了 500 错误之外,我们无法让 IIS 服务的页面给出任何错误。
追踪ASP时:
127. -ASP_SCRIPT_TRACE_COM_CALL_END FilePath C:\INETPUB\WWWROOT\MILER\GLOBAL.ASA LineNumber 6 CurrentStatement set g_pcmsrv=Server.CreateObject("PCMServer.PCMServer") SizeOfStatement 55 0 ms 128. -ASP_LOG_ERROR LineNumber 6 ErrorCode ASP 0177 : 8007007e Description Server.CreateObject Failed
DLL 是 PCMSRV32.DLL
在 c:\windows
GLOBAL.ASA:
Sub Application_OnStart
set g_pcmsrv=Server.CreateObject("PCMServer.PCMServer")
set application("g_pcmsrv") = g_pcmsrv
set g_pcmmapmgr=Server.CreateObject("Pcmgole.PCMMapMgr")
set application("g_pcmmapmgr") = g_pcmmapmgr
End Sub
Sub Session_OnStart
set Session("currentTrip") = application("g_pcmsrv").NewTrip("NA")
set Session("map") = application("g_pcmmapmgr").createMap()
End Sub
Sub Session_OnEnd
set Session("currentTrip") = Nothing
set Session("map") = Nothing
End Sub
Sub Application_Onend
Set application("g_pcmsrv")=Nothing
Set application("g_pcmmapmgr")=Nothing
End Sub
以下建议涉及 Server.CreateObject
和 CreateObject
在
Web 服务器部分是特定于 asp-classic 但仍然值得一读。
导致此错误的原因是什么?
Server.CreateObject Failed
最常见的情况是,当 Web 应用程序从一个 Web 服务器移动到另一个 Web 服务器时,不了解正在使用并向 Web 服务器注册的外部 COM 组件。
From PRB: Server.CreateObject Returns HTTP 500.100 or ASP 0177 Error (0x8007007E)
This error occurs when you attempt to use the Server.CreateObject method to instantiate an object that is not registered on the local system.
识别错误来源
如果您在 ASP Web 应用程序中使用 COM 组件,您将看到这样的一行
set g_pcmsrv=Server.CreateObject("PCMServer.PCMServer")
通常错误会指向 Set
行,这样可以更容易地确定原因 (幸运的是你有一些很好的跟踪代码,所以它更好)。
如果您不知道 DLL 的位置怎么办?
Note: Please be careful when accessing the Windows Registry as it is very easier to inadvertently make changes that have serious consequences for the Operating System and in extreme cases will require a system restore or re-install / repair.
CreateObject
方法中的字符串称为 ProgId
,用作 Windows 注册表中的键的标识符,可以在 [=82] 中找到=]
Note: Windows Registry can be browsed in most versions of Windows using the
regedit.exe
also known as the Registry Editor. Be very careful when using this tool to browse the Windows Registry.
HKEY_CLASSES_ROOT
并推而广之
HKEY_LOCAL_MACHINE\Classes
每当 ASP 处理器遇到 ProgId
时,它会尝试与 Windows 注册表对话并找到表示已注册 COM 可访问 DLL 位置的相应键。
HKEY_CLASSES_ROOT\PCMServer.PCMServer
一个常见的方法是密钥包含一个名为 CLSID
的子项,它指向关联的已注册 DLL 的 Class GUID。一旦 GUID 密钥位于
HKEY_CLASSES_ROOT\CLSID
hive 可以通过查看子键来查找位置
HKEY_CLASSES_ROOT\CLSID\{GUID from CLSID}\InprocServer32
位置将存储在 (default)
值中。
Example Using the
ProgId
-Scripting.FileSystemObject
Locate
Scripting.FileSystemObject
subkey inHKEY_CLASSES_ROOT
HKEY_CLASSES_ROOT\Scripting.FilesystemObject
Identify GUID from subkey
CLSID
HKEY_CLASSES_ROOT\Scripting.FilesystemObject\CLSID (default) - "{0D43FE01-F093-11CF-8940-00A0C9054228}"
Use GUID to find registered DLL subkey in
HKEY_CLASSES_ROOT\CLSID
HKEY_CLASSES_ROOT\CLSID\{0D43FE01-F093-11CF-8940-00A0C9054228}
Check subkey
InprocServer32
(default)
value for the DLL locationHKEY_CLASSES_ROOT\CLSID\{0D43FE01-F093-11CF-8940-00A0C9054228}\InprocServer32 (default) - "C:\Windows\System32\scrrun.dll"
注册表中 PCMServer.PCMServer
没有 ProgId
?
如果您在注册表中找不到相应的 ProgId
,可能是由于我们将在此处详细说明的两个原因之一。
- DLL 未注册。
- DLL 注册在错误的区域。
如何使用 Windows
注册 COM DLLCOM DLL 可以通过 运行 在 Windows 命令提示符下使用提升的权限 使用 regsvr32.exe
工具注册并创建相应的注册表项(这Windows).
在我们继续之前,虽然操作系统的体系结构和 ASP Web 应用程序使用的模式非常重要。
大多数较新的硬件都是 64 位的,这在 Windows 中造成了一个难题,因为它现在必须支持较新的 64 位架构并且仍然保持对 32 位架构的支持。 Microsoft 提出的解决方案是将 OS 一分为二,因此我们有 64 位元素和 32 位元素。主要 OS 程序分为两个文件夹 (仅在 64 位 OS 上,因为 32 位 OS 不必与 64 位竞争,即使硬件可以做到).
Note: On 32 Bit only systems just use the 64 Bit locations for both System Files and the Windows Registry.
在 64 位 OS 上,系统程序位于
对于 64 位程序
%SystemRoot%\System32\
对于 32 位程序
%SystemRoot%\SysWOW64\
这也适用于 Windows 注册表
64位
HKEY_CLASSES_ROOT
32位
HKEY_CLASSES_ROOT\Wow6432Node
例如,在 Windows 的 64 位版本上,以下命令将在 32 位注册表中注册 PCMSRV32.DLL
并创建关联的 COM DLL 注册表项。
C:\Windows\SysWOW64>regsvr32 "C:\Windows\PCMSRV32.DLL"
IIS 应用程序池
随着包括 IIS 在内的一切都开始支持 64 位,您仍然需要能够支持仅支持 32 位 COM 的遗留应用程序,因此在 IIS 6.0 中引入了 IIS (从 Windows 开始Server 2003,Service Pack 1) 在应用程序池下设置可配置的 属性 Enabled32BitAppOnWin64
,它允许应用程序池在 64 位版本的 运行 中以 32 位模式 Windows.
考虑到这一点,在您注册 COM DLL 以了解您应该在哪里注册它之前,您需要知道应用程序池是否 运行ning 在 32 位模式下。在 IIS 7.0 及更高版本中,您可以从 IIS 管理器应用程序内的应用程序池属性中检查它。该设置在 General
部分下的 Advanced Settings
中,称为 Enable 32-Bit Applications
(也可以在 applicationHost.config
中使用 enable32BitAppOnWin64
下的配置<ApplicationPools>
部分).
如果
Enable 32-Bit Applications
设置为False
IIS 应用程序池 运行 以本机 64 位模式运行,ASP Web 应用程序需要使用的任何 COM DLL 都需要支持 64 位并使用
regsvr32.exe
的 64 位版本将添加到 64 位注册表中。C:\Windows\System32>regsvr32 "C:\Windows\PCMSRV32.DLL"
如果
Enable 32-Bit Applications
设置为True
IIS 应用程序池 运行 正在 32 位模式下,ASP Web 应用程序需要使用的任何 COM DLL 都需要是 32 位 COM DLL,并使用要添加到 32 位注册表中的
regsvr32.exe
的 32 位版本。C:\Windows\SysWOW64>regsvr32 "C:\Windows\PCMSRV32.DLL"
使用错误版本的 regsvr32.exe
例如,使用
C:\Windows\SysWOW64>regsvr32 "C:\Windows\PCMSRV32.DLL"
当 IIS 应用程序池不是 32 位模式时,在 Windows 的 64 位版本上使用 32 位注册表注册 COM DLL 将导致 ASP 500.100
内部服务器错误
Server object error 'ASP 0177: 8007007e'
Server.CreateObject Failed
COM DLL 清单
什么是 IIS 应用程序池高级设置
Enable 32-Bit Applications
,因为它会影响您注册 COM DLL 的方式?DLL 是否使用
regsvr32.exe
的体系结构特定版本注册(如果 Windows 版本不是 64 位,则使用默认值) 反映了Enable 32-Bit Applications
? 的设置
Windows 注册表是否在
的体系结构特定位置包含 DLL 的ProgId
HKEY_CLASSES_ROOT
反映了
Enable 32-Bit Applications
? 的设置
InprocServer32
密钥是否包含 DLL 的正确位置?在我用来访问 COM DLL 的帐户上下文中 (ApplicationIdentity、LocalSystem、NetworkService 等),我是否有权访问物理 DLL 文件和注册表项?