p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

asp_components thread: Object Required error when using COM DLL


Message #1 by "Melissa Mussitsch" <melissa.mussitsch@a...> on Tue, 5 Mar 2002 15:29:18
Ok - I got my COM DLL to work in the sense that at least 

the "CreateObject" line is working!  My DLL coder had a messagebox if a 

database wasn't found in his code.



My problem now is that I want to make sure the it is actually working.  I 

was hoping to set one of the properties and then print the property.  But 

instead I get a 424 Object Required error on the print statement.  Here is 

the code:



Dim m_AnsLic



Set m_AnsLic = Server.CreateObject("ManGenCom.AnsLic.1")

Set licfile = Server.CreateObject("ManGenCom.License")

licfile.Customer = CStr("MCM Test Company")



on error resume next

Response.Write "customer is " & CStr(licfile.Customer)

if err.number > 0 then Response.Write "ERR" & err.description



Response.End



Can you please help?  Or even suggest a way to debug this?

Thanks.

Melissa Mussitsch
Message #2 by webmaster@c... on Thu, 21 Mar 2002 20:50:46
Hi Melissa,

  Ok, the first thing that bothered me was the Component Name

      Set m_AnsLic = Server.CreateObject("ManGenCom.AnsLic.1")

   I may be completly wrong on this one, and I have never tried it this way, but that Component Name  ManGenCom.AnsLic.1   looks
like a hierarchy of 3 objects..... try: "ManGenCom.AnsLic_1" for your component.
   If you rename it, read the next section, below:




Ok, putting the name aside: (I really am not sure about that one)


  In your VB Project for your component,  pull up the Properties for the Project. ( right click on "ManGenCom.vbp" and click
"Properties")

   Go to the "Component" Tab.

   See the "Version Compatibility" part?  VERY IMPORTANT.


      EVERY SINGLE TIME you change a COM interface on a Published COM Component(Add, Change or Delete  ANY PUBLIC Sub, Function, or
Property)  you MUST completely redo the Compatibility. ( you have "broken the COM Contract" with all client objects....and the
Windows Registry is out of wack..)


     Lets say that you just changed the Interface - maybe you added a new Public Sub.

     You should go to the above "Version Compatibility" tab, Select "No Compatibility" and Save the project. Then recompile.

    After you recompile, go back to "Version Compat." and Set to "Binary"   , selecting the new .dll in the bottom browse area. Save
again!


  THEN YOU MUST unregister the OLD Version from the old machines, put the new version on, then Re - Register.

   

   Lets say you have an older Version running on an IIS 4 machine ( IIS 5 is a lot easier !!!)

  1)You have to stop the IIS Service in the Services tab.
  2) unregister the Old component :
        at the command line:
        regsvr32 /u   c:\path\to\old\component.dll

  3) copy your new version over the old.

  4) Register the new version:

         at the command line:
          regsver32  c:\path\to\new\component.dll

  5) restart your service


 Sorry about the novel. Just two more things.

   1)    if you MOVE a .dll to a machine, you must register it to use it.
    SO if you develop on one machine, then move code to webserver, you must register it (step 4, above).

    2)   Your Component may be Using ANOTHER component - (in "Project", "References")
       that WAS installed on your development machine, but is not installed on the web server machine.  you should check all
dependencies.
   
  

Sorry about the novel. there are lots of reasons this can happen.......



> Ok - I got my COM DLL to work in the sense that at least 
> the "CreateObject" line is working!  My DLL coder had a messagebox if a 
> database wasn't found in his code.
> 
> My problem now is that I want to make sure the it is actually working.  I 
> was hoping to set one of the properties and then print the property.  But 
> instead I get a 424 Object Required error on the print statement.  Here is 
> the code:
> 
> Dim m_AnsLic
> 
> Set m_AnsLic = Server.CreateObject("ManGenCom.AnsLic.1")
> Set licfile = Server.CreateObject("ManGenCom.License")
> licfile.Customer = CStr("MCM Test Company")
> 
> on error resume next
> Response.Write "customer is " & CStr(licfile.Customer)
> if err.number > 0 then Response.Write "ERR" & err.description
> 
> Response.End
> 
> Can you please help?  Or even suggest a way to debug this?
> Thanks.
> Melissa Mussitsch
Message #3 by Melissa Mussitsch <melissa.mussitsch@a...> on Thu, 21 Mar 2002 16:06:33 -0500
He ended up having to write another DLL for ASP, different from his VB one.
He definitely had a versioning problem, so things weren't registered quite
right.
And we have had problems replacing and re-registering the DLL.  It seems ASP
hangs on to it and it stays in cache or something.  We always have to reboot
first.  Crazy!
He ended up commenting out some SQL queries that weren't needed for the ASP
version.  He thinks this may have been popping up an error message or
something that was causing things to hang.  This doesn't really make sense
to me, because the SQL that worked with VB should have worked also with ASP.
But he ended up only leaving in parts that only ASP needed, so we never
determined exactly the problem.  Unfortunately.  But it does seem to work
now.

Thank you for your comments (I'll definitely keep them in mind!)

Melissa

-----Original Message-----
From: webmaster@c...
[mailto:webmaster@c...]
Sent: Thursday, March 21, 2002 3:51 PM
To: ASP components
Subject: [asp_components] Re: Object Required error when using COM DLL


Hi Melissa,

  Ok, the first thing that bothered me was the Component Name

      Set m_AnsLic = Server.CreateObject("ManGenCom.AnsLic.1")

   I may be completly wrong on this one, and I have never tried it this way,
but that Component Name  ManGenCom.AnsLic.1   looks like a hierarchy of 3
objects..... try: "ManGenCom.AnsLic_1" for your component.
   If you rename it, read the next section, below:




Ok, putting the name aside: (I really am not sure about that one)


  In your VB Project for your component,  pull up the Properties for the
Project. ( right click on "ManGenCom.vbp" and click "Properties")

   Go to the "Component" Tab.

   See the "Version Compatibility" part?  VERY IMPORTANT.


      EVERY SINGLE TIME you change a COM interface on a Published COM
Component(Add, Change or Delete  ANY PUBLIC Sub, Function, or Property)  you
MUST completely redo the Compatibility. ( you have "broken the COM Contract"
with all client objects....and the Windows Registry is out of wack..)


     Lets say that you just changed the Interface - maybe you added a new
Public Sub.

     You should go to the above "Version Compatibility" tab, Select "No
Compatibility" and Save the project. Then recompile.

    After you recompile, go back to "Version Compat." and Set to "Binary"
, selecting the new .dll in the bottom browse area. Save again!


  THEN YOU MUST unregister the OLD Version from the old machines, put the
new version on, then Re - Register.

   

   Lets say you have an older Version running on an IIS 4 machine ( IIS 5 is
a lot easier !!!)

  1)You have to stop the IIS Service in the Services tab.
  2) unregister the Old component :
        at the command line:
        regsvr32 /u   c:\path\to\old\component.dll

  3) copy your new version over the old.

  4) Register the new version:

         at the command line:
          regsver32  c:\path\to\new\component.dll

  5) restart your service


 Sorry about the novel. Just two more things.

   1)    if you MOVE a .dll to a machine, you must register it to use it.
    SO if you develop on one machine, then move code to webserver, you must
register it (step 4, above).

    2)   Your Component may be Using ANOTHER component - (in "Project",
"References")
       that WAS installed on your development machine, but is not installed
on the web server machine.  you should check all dependencies.
   
  

Sorry about the novel. there are lots of reasons this can happen.......



> Ok - I got my COM DLL to work in the sense that at least 
> the "CreateObject" line is working!  My DLL coder had a messagebox if a 
> database wasn't found in his code.
> 
> My problem now is that I want to make sure the it is actually working.  I 
> was hoping to set one of the properties and then print the property.  But 
> instead I get a 424 Object Required error on the print statement.  Here is

> the code:
> 
> Dim m_AnsLic
> 
> Set m_AnsLic = Server.CreateObject("ManGenCom.AnsLic.1")
> Set licfile = Server.CreateObject("ManGenCom.License")
> licfile.Customer = CStr("MCM Test Company")
> 
> on error resume next
> Response.Write "customer is " & CStr(licfile.Customer)
> if err.number > 0 then Response.Write "ERR" & err.description
> 
> Response.End
> 
> Can you please help?  Or even suggest a way to debug this?
> Thanks.
> Melissa Mussitsch
 
melissa.mussitsch@a...
%%email.unsub%%


  Return to Index