Error when instantiating .NET/COM interop class via classic ASP

Posted by Lee D on Stack Overflow See other posts from Stack Overflow or by Lee D
Published on 2009-11-12T16:10:39Z Indexed on 2010/05/23 4:00 UTC
Read the original article Hit count: 452

Filed under:
|
|
|

Hi all,

I am having a problem when trying to instantiate a C# .NET class that's been exposed to COM in a classic ASP application. I've used tlbexp to generate a typelib and registered it in Component Services; now when trying to create the object as such:

Server.CreateObject("The.Class.Name")

I am getting the error:

Server object error 'ASP 0177 : 80131534'

Server.CreateObject Failed

I've searched around online for information on this error, and found numerous discussions but no solution. The error code 0x80131534 apparently means "COR_E_TYPEINITIALIZATION, a type failed to initialize", which would suggest the problem would be in the constructor. The constructor of the class in question sets a private field to an instance of another class from the same assembly, and then reads some configuration settings from an XML file. This behaviour is unit tested and I've checked that the file exists; I can't see anything else that could be breaking in there.

A few other points which may or may not be of use:

  • A test .NET project referencing the DLL can instantiate the class just fine; however a test VB6 project referencing the TLB blows up with the same error. Both the DLL and the TLB are in the same location.
  • This application is running locally, on Windows XP Professional SP3 and IIS 5.1.
  • The .NET assembly is built with .NET Framework 2.0, although 3.5 is installed on the machine.

I know other people who don't get this error on their builds, so I believe it may be something environmental. Any suggestions are welcome as I've been struggling to fix this for some time.

Thanks in advance.

© Stack Overflow or respective owner

Related posts about .NET

Related posts about com