We have been trying to install a COM DLL on a new server. The interface is Classic ASP. The Map Connector DLL seems to be the problem but that is as far as I am able to get.
We are unable to get the pages served by IIS to give anything other than a 500 error.
When tracing the 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
The DLL is PCMSRV32.DLL
in 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
The advice below relates to both
Server.CreateObject
andCreateObject
use invbscript jscript vba
The Web Server sections are specific to asp-classic but still worth reading.
What Causes This error?
is caused most commonly when Web Applications are moved from one Web Server to another without an understanding of external COM components that are in use and registered with the Web server.
Identifying the Source of the Error
If you are using COM components inside a ASP Web application you will see a line like this
Usually the error will point to the
Set
line which makes identifying the cause easier (luckily you have some nice trace code in place so it's even better).What If You Don't Know Where the DLL Is Located?
The string inside the
CreateObject
method is known as aProgId
and is used as an identifier to a key inside the Windows Registry that can be found inside theand by extension
Whenever the ASP processor encounters a
ProgId
it attempts to talk to the Windows Registry and find a corresponding key that denotes the location of the registered COM accessible DLL.A common approach to this is the key contains a subkey called
CLSID
which points to the Class GUID for the associated registered DLL. Once the GUID key is located in thehive it can be used to find the location by looking in the subkey
where the location will be stored in the
(default)
value.No
ProgId
forPCMServer.PCMServer
in the Registry?If you cannot find the corresponding
ProgId
in the registry it is likely due to one of two reasons we will elaborate on here.How to register COM DLL with Windows
COM DLLs can be registered and have the corresponding Registry entries created by running the
regsvr32.exe
tool from the Windows Command Prompt using elevated permissions (this varies from version to version of Windows).Before we continue though the architecture of both the Operating System and the mode used by the ASP Web application are very important.
Most newer hardware is 64 Bit this creates a conundrum in Windows as it now has to support newer 64 bit architecture and still maintain support for 32 bit architecture. The solution Microsoft came up with was to split the OS in two, so we have 64 bit elements and 32 bit elements. The main OS programs are broken down into two folders (only on 64 bit OS because a 32 Bit OS doesn't have to contend with 64 Bit, even if the hardware is capable of it).
On a 64 Bit OS the System Programs are located in
For 64 Bit programs
For 32 Bit programs
This is also applies to the Windows Registry
64 Bit
32 Bit
So for example on a 64 Bit version of Windows the following command will register the
PCMSRV32.DLL
in the 32 Bit Registry and create the associated COM DLL registry keys.IIS Application Pool
As everything begins to support 64 Bit including IIS you still need to be able to support legacy applications that only support 32 Bit COM, so IIS introduced in IIS 6.0 (starting with Windows Server 2003, Service Pack 1) under the Application Pool settings the configurable property
Enabled32BitAppOnWin64
which allows the Application Pool to run in 32 Bit mode on 64 Bit versions of Windows.With this in mind before you register the COM DLL to know where you should be registering it you need to know whether the Application Pool is running in 32 Bit Mode. In IIS 7.0 and above you can just check this from the Application Pool properties inside the IIS Manager application. The setting is in the
Advanced Settings
under theGeneral
section and is calledEnable 32-Bit Applications
(can also be configured in theapplicationHost.config
usingenable32BitAppOnWin64
under the<ApplicationPools>
section).If
Enable 32-Bit Applications
is set toFalse
The IIS application Pool is running in native 64 Bit mode and any COM DLLs that need to be used by the ASP Web Application will need to support 64 Bit and be registered using the 64 Bit version of
regsvr32.exe
to be added into the 64 Bit registry.If
Enable 32-Bit Applications
is set toTrue
The IIS Application Pool is running in 32 Bit Mode and any COM DLLs that need to be used by the ASP Web Application will need to be 32 Bit COM DLLs and be registered using the 32 Bit version of
regsvr32.exe
to be added into the 32 Bit registry.Registering the COM DLL Using the Wrong Version of
regsvr32.exe
For example using
to register the COM DLL with the 32 Bit registry on a 64 Bit version of Windows when the IIS Application Pool is not in 32 Bit Mode will cause the ASP
500.100
Internal Server errorCOM DLL Checklist
What is the IIS Application Pool Advanced Setting
Enable 32-Bit Applications
set to, as it impacts on how you register the COM DLL?Is the DLL registered using the architecture specific version of
regsvr32.exe
(if Windows version isn't 64 Bit use the default) that reflects the setting ofEnable 32-Bit Applications
?Does the Windows Registry contain a
ProgId
for the DLL in the architecture specific location ofthat reflects the setting of
Enable 32-Bit Applications
?Does the
InprocServer32
key contain the correct location for the DLL?In the context of the account I'm using to access the COM DLL (ApplicationIdentity, LocalSystem, NetworkService etc), do I have permission to access both the physical DLL file and the registry entries?
Useful Links