1

I have a server running Windows 2003 64-bit, that runs IIS in 32-bit mode. I have a COM object that was registered using the following command:

C:\WINDOWS\microsoft.net\Framework\v2.0.50727>regasm D:\Path\To\MyDll.dll /tlb:MyTLB.tlb /codebase

When I create the object via ASP I get:

Server object error 'ASP 0177 : 8000ffff'

Server.CreateObject Failed

/includes/a_URLFilter.asp, line 19

8000ffff 

When I create the object in a vbs script and use the 32-bit version of cscript (in \Windows\syswow64) it works fine.

I've checked permissions on the DLL, and the IUSR has Read/Execute.

Even if I add the IUSR to the Administrators group, I get the same error.

This is the log from ProcessMonitor filtering for the path of my dll (annotated with my actions):

[Stop IIS]
1:56:30.0891918 PM  w3wp.exe    4088    CloseFile   D:\Path\To\MyDll.dll    SUCCESS 
[Start IIS]
[Refresh ASP page that uses DLL]
1:56:42.7825154 PM  w3wp.exe    2196    QueryOpen   D:\Path\To\MyDll.dll    SUCCESS CreationTime: 8/19/2009 1:11:17 PM, LastAccessTime: 8/19/2009 1:30:26 PM, LastWriteTime: 8/18/2009 12:09:33 PM, ChangeTime: 8/19/2009 1:22:02 PM, AllocationSize: 20,480, EndOfFile: 20,480, FileAttributes: A
1:56:42.7825972 PM  w3wp.exe    2196    QueryOpen   D:\Path\To\MyDll.dll    SUCCESS CreationTime: 8/19/2009 1:11:17 PM, LastAccessTime: 8/19/2009 1:30:26 PM, LastWriteTime: 8/18/2009 12:09:33 PM, ChangeTime: 8/19/2009 1:22:02 PM, AllocationSize: 20,480, EndOfFile: 20,480, FileAttributes: A
1:56:42.7826961 PM  w3wp.exe    2196    CreateFile  D:\Path\To\MyDll.dll    SUCCESS Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: Read, Delete, AllocationSize: n/a, Impersonating: SERVER2\IUSR_SERVER2, OpenResult: Opened
1:56:42.7827194 PM  w3wp.exe    2196    CreateFileMapping   D:\Path\To\MyDll.dll    SUCCESS SyncType: SyncTypeCreateSection, PageProtection: 
1:56:42.7827546 PM  w3wp.exe    2196    CreateFileMapping   D:\Path\To\MyDll.dll    SUCCESS SyncType: SyncTypeOther
1:56:42.7829130 PM  w3wp.exe    2196    Load Image  D:\Path\To\MyDll.dll    SUCCESS Image Base: 0x6350000, Image Size: 0x8000
1:56:42.7830590 PM  w3wp.exe    2196    Load Image  D:\Path\To\MyDll.dll    SUCCESS Image Base: 0x6360000, Image Size: 0x8000
1:56:42.7838855 PM  w3wp.exe    2196    CreateFile  D:\Webspace\SecurityDll\bin SUCCESS Desired Access: Read Data/List Directory, Synchronize, Disposition: Open, Options: Directory, Synchronous IO Non-Alert, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, Impersonating: SERVER2\IUSR_SERVER2, OpenResult: Opened
1:56:42.7839081 PM  w3wp.exe    2196    QueryDirectory  D:\Path\To\MyDll.INI    NO SUCH FILE    Filter: SecurityDll.INI
1:56:42.7839281 PM  w3wp.exe    2196    CloseFile   D:\Webspace\SecurityDll\bin SUCCESS 

[Refresh ASP page that uses DLL]
[Refresh ASP page that uses DLL]
[Refresh ASP page that uses DLL]

This dll works fine on other servers, running 32-bit windows. I can't think of anything else that would make this work. Any suggestions?

UPDATE>

The .dll is not in the GAC, it is compiled as 32-bit, and is Strongly signed.

DrFredEdison
  • 261
  • 4
  • 11
  • Sounds to me like this belongs in Stack Overflow. It doesn't look like a 'sysadmin' issue, but a 'COM in 64-bit Windows' programming question. – Euro Micelli Aug 18 '09 at 20:31
  • Can you instantiate other 32-bit COM objects just fine? – Goyuix Nov 09 '09 at 02:33
  • @DrFredEdison I posted something similar to this about a week ago where I was trying to register a 32bit COM object in 64bit Windows 2008 and had no luck finding a solution. It was being called from a classic ASP page and so I just rewrote it into an ASP includes. If the object is simple enough that may be your best solution in this case. – ajdams Mar 15 '10 at 13:08

5 Answers5

1

Yeah if the .NET DLL-s are compiled for 64-bit forget it :(. 32bit and 64 bit modules can't mix together (COM or no COM) in the same process.

1

Couple of things to check:

  • Check to see if that .dll is also in the global assembly cache (it shouldn't be). Look in Control Panel | Administrative Tools for .NET Framework 2.0 Configuration which will let you inspect the GAC
  • The assembly has to be strong named assembly (signed and all that)

Have a look at the regasm MSDN page.

Also, that .dll wasn't compiled for 64-bit, was it? (just to rule out the obvious...)

squillman
  • 37,618
  • 10
  • 90
  • 145
0

I was trying to do the exact same thing but with a Win 7 and IIS 7.5. I was eventually able to get it to work by using both the 32 bit and 64 bit versions of REGASM but was not able to trace exactly which one made the system work.

smaclell
  • 101
  • 2
0

You guys NEED to learn reading - this is not asp.net.

  • Ok, first: 32 bit is nice, but 32 bit mode IIRC is NOT for ASP, ONLY for ASP.NET.
  • As such, ASP (classic ASP, which is what your URL indicates) will STILL be 64 bit.
  • And as you can not load a 32 bit com oejct in a 64 bit process space - there you go. Error explained.

Basically I suggest going back and installing 32 bit OS here, then mid term (ASAP) retire ASP for ASP.NET.

TomTom
  • 50,857
  • 7
  • 52
  • 134
  • I posted this a long time ago, and this isn't my problem anymore (I don't even have access to the server in question any longer,) but this makes perfect sense and I'm really surprised I didn't see it before. – DrFredEdison Nov 15 '10 at 16:56
  • 2
    In addition to accepting your answer, I'll give you +1 if you remove the condescending language at the beginning of your answer. Its a correct answer, but we don't need to encourage that sort of environment here. – DrFredEdison Nov 15 '10 at 16:58
  • Classic "SO" user approach. First insult, then help! – curiousBoy Nov 24 '16 at 01:29