none
ActiveX component can't create object

    Question

  • I have an ActiveX dll written in VB6. When using the dll in a VB.Net Windows application, it works fine. When using it in an Web application I get the above error; e.g.:

    • Dim myObject As Ns.Object = New Ns.Object()
    • Dim result as String = myObject.Test() '--ActiveX component can't create object

    I have tried (based on Google and other searches):

    1. Giving anyone and everyone Full Control in the directory with the ActiveX dll
    2. Updating the IIS configuration to all operations in the virtual directory
    3. Creating a .Net dll to wrap the ActiveX dll and installing the dll and interops into the GAC.

    I have seen this question posted elsewhere but I haven't seen a solution posted. Any thots?

    pjp

    Tuesday, September 05, 2006 3:55 PM

Answers

  • That error within ASP.Net typically means the user account the asp.net page is running under does not have sufficient permissions to access DCOM. 

    This article has a little bit more detail.  It's specific to Office but the principal is the same.

    http://support.microsoft.com/default.aspx?scid=kb%3ben-us%3b257757

     

     

    Wednesday, September 06, 2006 3:17 PM
    Moderator
  • Final Final answer.

    The DLL also needed to be registered by the user account that IIS was using. That is, I had to temporarily give the IIS account interactive login privileges and re-register the dll.

    pjp

    Thursday, November 30, 2006 10:49 PM

All replies

  • By default VB6 components are STA components by default.  To enable using this on an ASP.Net page, add the following line to the top of the page

    <%@ Page ASPCompat="true" %>

     

    Tuesday, September 05, 2006 5:49 PM
    Moderator
  • Shoot, I forgot to mention I tried that too.

    pjp

    Tuesday, September 05, 2006 6:00 PM
  • Are you getting any kind of error message when you try and create the object?
    Tuesday, September 05, 2006 6:18 PM
    Moderator
  • No, just "ActiveX component can't create object"

    pjp

    Tuesday, September 05, 2006 7:31 PM
  • That sounds like creating the VB6 component has been successful.  By that I mean it found, created and started running code from it.  But that the actual VB6 component is failing to create some internal object.  Do you have access to the VB6 component source, can you add some message boxes, debug statements or such?
    Tuesday, September 05, 2006 10:30 PM
    Moderator
  • You're right. I wrote a Vb6 function that pinpoints the point of failure in the vb6 code; however, the results don't help me much.

    This doesn't produce errors in a .Net Windows Application:

    ChDir "c:\inetpub\wwwroot\comptmap\bin"
    Dim sv As New NDNX.NDOleNXServerObj
    Dim nkbs As NDNX.kbs
    Set nkbs = sv.kbs
    ActiveX component can't create object

    Interestingly, if I try to instantiate the classes directly from asp.net instead of using the vb6 component, I get this error:

    Retrieving the COM class factory for component with CLSID {905F1BE3-F9F3-11CE-BE3A-0800091B2BFC} failed due to the following error: 80080005.

    Wednesday, September 06, 2006 3:00 PM
  • That error within ASP.Net typically means the user account the asp.net page is running under does not have sufficient permissions to access DCOM. 

    This article has a little bit more detail.  It's specific to Office but the principal is the same.

    http://support.microsoft.com/default.aspx?scid=kb%3ben-us%3b257757

     

     

    Wednesday, September 06, 2006 3:17 PM
    Moderator
  • Yippie!  I changed the app pool to a different account. I should have thought of that. 

    Thanks for the help,

    pjp

    Wednesday, September 06, 2006 3:34 PM
  • Shortly after getting it to work, it stopped working again. I've tried rebuilding the interops and everything for which I have access to the code. I am getting the same error in the same place in the ActiveX DLL. The new error when trying to use the interops directly from ASP.NET is:

    Unable to cast COM object of type 'NDNX.NDOleNXServerObjClass' to interface type 'NDNX.NDOleINXServerObj'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{905F1BE1-F9F3-11CE-BE3A-0800091B2BFC}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

    The Windows App still works fine. I have no Idea what I could have done to break it, other than that I tried some different service accounts and rebuilt the dll.  I'll try and open a support incident tomorrow but I thought I would check here first to see if there was something else I could try first.

    Thanks,

    pjp 

    Monday, September 18, 2006 8:57 PM
  • Final Final answer.

    The DLL also needed to be registered by the user account that IIS was using. That is, I had to temporarily give the IIS account interactive login privileges and re-register the dll.

    pjp

    Thursday, November 30, 2006 10:49 PM
  • I had the similar kind of problem and have solved something like this

    Create a Automation user account on the server

    Give full permission (appropriately) according to your requirement. Atleast this should be able to access all the resources your automation application wants to access.

    Use DCOM configration (Component Services from Control Panel) on the server. Expand to mycomputer-->DCom Config.

    You will see a list of application, select the application you want to automate, Right Click-->Properties-->Security-->Customise Launch/Access permission. -->Edit---> add the user to access this resource and assign permission. (Play around according to your need).

    From Properties-->Identity tab--> Select this User and enter usern and confirm the password. This will make sure when this application is accessed via Automation it will use this account.

    Now if you are using a ASP net application. Go to properties-->Directory Security-->Enable Annonymous access-->specify the automation user.

    Thats it...you should be able to run the application with out any problem.

    I was very vague with the explanation. Sorry could not find time to put in much more greater detail.

    Hope this helps

    Regards

    R G

     

     

     

    Thursday, January 18, 2007 12:02 PM
  • Hi Jared,

     

    I'm getting the following error, it is on a new "vanilla" windows 2003 Enterprise system with .netfx3  installed.

     

    Microsoft VBScript runtime error '800a01ad'

    ActiveX component can't create object: 'BinaryReader.Reader'

    /profile.inc, line 7

     

    I checked and the dll folder allows read to everyone.  I've done a lot of looking around and am not finding an answer.  I confirmed mscorlib.dll is on the system.  It appears it cannot be loaded using regsvr32 and I'm not sure how to confirm it is loaded.  This particular DLL seems to be special case and it makes me wonder if .net calls from asp in general are just broken.  Any pointers would be appreciated.  Here is the code that is breaking:

    <%
    If Session("UserID") = "" Then
     Response.Redirect("default.asp")
    End If
    Set Obj = new cMembers
    Set Obj.connection = cnt
     set BR = CreateObject("BinaryReader.Reader")
     set BR.Request = Request

     

    set filterdic = getfilter()
    if (InStr(Request.ServerVariables("REQUEST_METHOD"), "POST")) then
     BR.Parse
     set filterdic = getfilter()

     Obj.Load Session("UserID")

     for each key in BR.form
      if key <> "Upload_Photo" then
       Obj.field(key) = br.form(key).Item(0).Data
      end if
     next
     'Obj.field("Status") = 1
     
     errmessage = ""
     set rsTemp = cnt.Execute("exec actCheckUniqueMember @UserName='" & Obj.field("Username") & "', @id=" & gnn(Array(Obj.field("ID"))))
     if not rsTemp.eof then errmessage = rsTemp("errmsg")

     If errmessage = "" Then
      Obj.Save
      saveimg = saveanddel("/upload/members/", obj, br)
      Act = "Save"
     Else
      Response.Write "<script>window.alert('User: " & Obj.field("UserName") & " has exists'); " & vbNewLine & " document.location.href='" & URL & "?id=" & Obj.field("ID") & "& "& writeFilter(filterdic,"get","") &"';</script>"
     End If
    else
     Obj.Load Session("UserID")
    End If
    %>

    Thursday, April 05, 2007 3:01 PM
  • Hi All,

              For me too the same problem occured when trying to use MapPoint with my asp.net application. 

    In the DCOMCNG give the permissions to the com component with the aspnet and in the web.config, i added the following line of the username and password. 

    <identity impersonate="true" userName="******UserName**********" password="********Password************"/>

     

    It worked fine for me.   Hope this will be useful.

     

     

    Could anyone suggest me how to avoid giving the UserName and Password in the web.config.  Our client is not accepting this to enter his password in the web.config file.  for that there is an option in the DCOMCONFIG itself.  In the properties, there is a tab called Identity.  in that we are able to give the password and username.  But it works for windows2003 and not for XP

     

    Regards,

    Sathish.N.

     

     

    Monday, March 03, 2008 7:51 AM
  • Hi,

     

    Could you please let me know if the adding security permissions to the user under DCOM config application in Component Services made you working without your above mentioned error?

     

    I am getting a similar error:-

    Unable to cast COM object of type 'PDFTemplateFilterServer.DocumentClass' to interface type 'PDFTemplateFilterServer.IPDFTemplateFilterServer'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{14C39669-8BB4-45EF-937A-4B947BC45E78}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

     

    I tried all possible things..like registering the related interop dll's, givin permissions...but not yet workin!!

     

    Please let me know about this ASAP.

     

    Thanks,

    Anagha

    Monday, May 19, 2008 6:28 AM
  • I got the same issue. After lots of browsing and breaking my head. I just changed the application pool from Classic to Integrated and it started working :)
    Tuesday, June 03, 2014 4:16 PM