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 object error '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 object error 'ASP 0177 : 80070002'

Server.CreateObject Failed

/mears/ReadUserCert.asp, line 56

80070002

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

Public Class 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.

Public Const ClassId As String = "d3631825-7853-42b7-8e99-c830d52e1b8f"

Public Const InterfaceId As String = "a7c0b4bc-b92a-44de-a60d-77f0ca829794"

Public Const EventsId As String = "feafc6d3-8ff7-4db4-b892-0aea80a62731"

#End Region

' 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.

Public Sub New()

MyBase.New()

End Sub

Public Function TestFunction() As String

Return "testcall"

End Function

End Class




Answer this question

Com Object Failing on server.createobject

  • svashchenko

    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.




  • Edward Clements

    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.



  • rano

    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.


  • CleverHans

    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.



  • TypeON

    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.


  • LeRainieur

    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.



  • Saberinth

    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.



  • HolmesConan

    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.



  • Com Object Failing on server.createobject