Server.CreateObject Fails when calling .Net object from ASP on 64-bit windows in IIS 32-bit mode

64-bitaspcomnetwindows-server-2003

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.

Best Answer

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.