We help IT Professionals succeed at work.

"Server.CreateObject Failed"- when trying to create an ActiveX VB dll from an ASP page

rlall
rlall asked
on
Hi
This is the first time I am trying to make a call to an ActiveX dll in VB from an ASP page. I have created a very simple ActiveX dll in VB that simply builds an array and then from my ASP page I try and access this array and do a Response.Write on it to print out the values contained in the Array.

Here is the code in the ASP page that I use to create the dll object:
<%
    dim obj
    set obj = server.createObject("prjImage.clsImage")
%>

I get the following error message when I try to create the ActiveX dll object when i run the ASP page.

***********************************************
Server object error 'ASP 0177 : 800401f3'

Server.CreateObject Failed
/jspdev/Test/Default.asp, line 12
Invalid class string
***********************************************

I have done the following:
1. Built an ActiveX dll using VB 6.0 and the compiled the dll in the same directory as the asp page on the webserver
2. registered the dll on the webserver that runs the ASP page
3. When I run my ASP page I get the above error message.

Can someone tell me what step I am missing?

Thanks for your response in advance.



Comment
Watch Question

Commented:
I'm betting that the classstring used isn't correct (prjImage.clsImage).

Check the servers registry using RegEdit.exe and search for it to find out what it looks like in the registry.

Author

Commented:
Thanks for your response but the problem was not with the name of the class that i was using. It was because the .dll was not in the WINNT\System32 directory. When I put the dll and the associated lib files in the above directory it works just fine.

Commented:
Normally if you've registered the OCX/DLL with regsvr32.exe it doesn't matter where it's located.

If you haven't, putting it in the system path will indeed do the trick.

Michel SakrRounded IT Consultant / Projects manager / Cloud Consultant / IT Planning
CERTIFIED EXPERT

Commented:
It seems that you didn't preserve compatibility in your project propreties and you recompiled over the old dll after registering, I suggest you unregister (same as registring but with a /u option) the dll and then register it again.. but better you include it in MTS or COM+ as a package, otherwise IIS will lock the dll and you'll need to restart IISADMIN service and related to it services to unlock the dll..



Start the Component services..in the tree select computers.. mycomputer..com+ applications...right click on it--> new -> application.. now in the wizard click next and select an empty application -> name your package  leave it in server process and click next -> Select the user and enter an account with enough rights to fufill your com jobs (admin account for ex) -> Finish..

now in the tree expand the new package untill you see the component directory-> right click it -> select new component-> in the wizard click next.. you can either install a new component if it's not registred or install a registred one if you already registred your dll (you select the 2nd choice) -> Select your component from the list (internal name displayed) -> Finish..

and voila..


In MTS (IIS4)

Start MMC (Microsoft management console.. from IIS or MTS) -> Select in the tree Microsoft Transaction.. -> My computer ->right click packages installed -> new package -> click on create an empty package and name the package, next -> select this user and give an admin user for the package -> finish  , now we'll need to include your registered component in the package(dll).. Expand the newly created package in the tree and right click on components folder-> new component -> select import components that are already registered -> you'll get a list of registered components on that machine.. select your component to include by it's class name -> Finish  note that your activex dll should be set to run unattended while compiling..

Commented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this

question is:

PAQ/refund
Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
lavinder
EE Cleanup Volunteer
Commented:
Per Recommendation,

PashaMod
Community Support Moderator @Experts Exchange

Explore More ContentExplore courses, solutions, and other research materials related to this topic.