2
votes

I have a COM component that I would like to use from Classic ASP. It is registered correctly using both the 64 and 32 bit version of regasm, using the /codebase switch.

All assemblies are signed with a strong name (although the key is not protected with a password). When I register the types, I get a confirmation that they were registered successfully.

If I make a VBScript file that attempts to create the COM component, it succeeds without issues when I run it with both the 64 and the 32 bit version of cscript.exe.

However, when I try to do a Server.CreateObject on the exact same COM component, I get the following error:

Server object error 'ASP 0177 : 80070002'

Server.CreateObject Failed

somefile.asp, line 2

80070002

The line provided by the excepton just contains the Server.CreateObject statement.

The assembly is AnyCPU, and the type I am trying to expose has a [ComVisible(true)] attribute set on it. The rest of the assembly is not COM visible.

Any clue on what I am experiencing here? I tried giving full permission to Everyone for the DLL files because I originally thought it was an IIS issue. However, that simply doesn't seem to be the case.

I have Googled this for many hours and seen countless similar questions, but this is not related, since none of the proposed solutions work.

2
in ancient time i did registration by using c:\windows\syswow64\regsvr32.exe for 32bit COM components on x64 OS and by using c:\windows\system32\regsvr32.exe for 64bit COM components on x64 OS - Zam
asp is 32bit. did you allow to run 32bit app's in IIS for your app pool? - Zam
80070002 is ERROR_FILE_NOT_FOUND. Use Process Monitor to see what is missing. - Sheng Jiang 蒋晟
@ShengJiang蒋晟 Process monitor doesn't seem to show anything of relevance. @Zam yes, it doesn't make a difference. Also, note that this is a .NET component so regsvr32 won't work, regasm must be used instead. - Mathias Lykkegaard Lorenzen
Might help if you explain what the COM component does it terms of initialisation, does it depend on certain files or folder structure for example? - user692942

2 Answers

2
votes

If it works correctly with cscript.exe and failed in ASP, almost all the time that is due to the security context or file/register permission issue. ASP runs under the IIS user realm, and you will need to ensure that user ID has access to all the resources (including temp file/folder) needed for your COM object.

1
votes

I solved it, but as I suspected, it wasn't the same cause as seen in other questions.

Apparently if you try to register a DLL from a network share, it will provide those symptoms, although the message is "Types registered successfully".

Very scary.

When moving all my DLLs to a local folder on the machine, they registered and ran successfully without issues.