Com Object Failing on server.createobject

I am having problems calling a Com object that I created under Visual Studio 2005 with Standard ASP. I registered it using regasm.exe. Below is my code (VB) . I have tried creating the object two ways. What am I doing wrong ?

Server.CreateObject("TestCom2.TestFunction") and

Server objecterror 'ASP 0177 : 800401f3'

Server.CreateObject Failed

/mears/ReadUserCert.asp, line 56

800401f3

Calling this way gives this message (which I think is correct)

Server.CreateObject("TestCom2.MyComClass")

Server objecterror 'ASP 0177 : 80070002'

Server.CreateObject Failed

/mears/ReadUserCert.asp, line 56

80070002

<ComClass(MyComClass.ClassId, MyComClass.InterfaceId, MyComClass.EventsId)> _

PublicClass MyComClass

#Region"COM GUIDs"

' These GUIDs provide the COM identity for this class

' and its COM interfaces. If you change them, existing

' clients will no longer be able to access the class.

PublicConst ClassIdAsString ="d3631825-7853-42b7-8e99-c830d52e1b8f"

PublicConst InterfaceIdAsString ="a7c0b4bc-b92a-44de-a60d-77f0ca829794"

PublicConst EventsIdAsString ="feafc6d3-8ff7-4db4-b892-0aea80a62731"

#EndRegion

' A creatable COM class must have a Public Sub New()

' with no parameters, otherwise, the class will not be

' registered in the COM registry and cannot be created

' via CreateObject.

PublicSubNew()

MyBase.New()

EndSub

PublicFunction TestFunction()AsString

Return"testcall"

EndFunction

EndClass

[3189 byte] By [BobTheHacker] at [2008-1-10]
# 1
You want to create the object the second way, as you thought. Everything looks good. You probably have a security problem, this webpage might help.

nobugz at 2007-10-3 > top of Msdn Tech,Visual Basic,Visual Basic Language...
# 2

Tried setting the permissions as suggested. Plus have granted "everyone" full on the Dll and it still tanks.

Any other Idea. I had this issue with cdnots.sendemail until I rgsvr32 it. But you can't do that with a .Net dll.

BobTheHacker at 2007-10-3 > top of Msdn Tech,Visual Basic,Visual Basic Language...
# 3
Regasm should have taken care of the registration. But it doesn't hurt to double-check. Start + Run, Regedit. Navigate to HKCR\TestCom2.MyComClass. Take note of the CLSID key value. Navigate to HKCR\CLSID\{value} and check if it looks good.
nobugz at 2007-10-3 > top of Msdn Tech,Visual Basic,Visual Basic Language...
# 4

They all look good. That is one thing I checked earlier.

I have seen a lot of issues on the net about calling .Net objects from standard asp. I don't understand why it is not finding it. I have the dll in the same directory as the asp code and even moved and registered it in the System32 directory as well.

BobTheHacker at 2007-10-3 > top of Msdn Tech,Visual Basic,Visual Basic Language...
# 5
Let's make sure this isn't a security problem. Make a Q&D little VB.NET form that calls CreateObject() and see if you can get it to fail too.
nobugz at 2007-10-3 > top of Msdn Tech,Visual Basic,Visual Basic Language...
# 6

Something just started working. I got pass the fail to create object. So I am now hitting the come object, and am getting the error message that buffering needs to be turned on. So it is finding my dll, which was holding me up all along.

Now I can write my methods I need to do, since I proved I could hit it.

Thanks for your help.

BobTheHacker at 2007-10-3 > top of Msdn Tech,Visual Basic,Visual Basic Language...
# 7

For those who hit this looking for a solution and this does not help too much. When you register .NET COM modules you must use regasm and if you want to call them from applications like IIS you must use /codebase with this command:

regasm your.dll /codebase

I hope this helps. It solved this error for me.

pfelsted at 2007-10-3 > top of Msdn Tech,Visual Basic,Visual Basic Language...
# 8
Yeah, not a great thread. "Something just started working" isn't a great lead. Thanks for your feedback, the points you brought up are quite valid.
nobugz at 2007-10-3 > top of Msdn Tech,Visual Basic,Visual Basic Language...