Solved

Can not create object!

Posted on 2004-10-04
63
1,347 Views
Last Modified: 2007-12-19
please explain why:


Dim objManager
Set objManager = CreateObject("AutoTrans.Manager")

I run this code in vb6 runs without a problem.

I run it in an asp page. I get error:

Microsoft VBScript runtime error: ActiveX component can't create object: 'AutoTrans.Manager'

how can I fix this

Thanks.
0
Comment
Question by:unknown_routine
  • 23
  • 7
  • 5
  • +6
63 Comments
 
LVL 19

Expert Comment

by:peh803
ID: 12218725
This probably indicates that you're using a class written in the VB App that hasn't been compiled into a DLL and registered on the web application server.  Is there an "AutoTrans" or "Manager" class in the vb project?  If so, in order to use it in asp, you'll have to compile it into a DLL file, stop IIS, register the DLL on the web server (cmd prompt command = regsvr32 c:\yourpath\yourcompiledobject.dll), and restart IIS.

hope this helps,
peh803
0
 
LVL 10

Expert Comment

by:ALaRiva
ID: 12219250
In addition to the suggestions by peh803, ASP is a Server-Side Language.  Thus you need to change the way you use CreateObject()

Try changing it to this:
Dim objManager
Set objManager = Server.CreateObject("AutoTrans.Manager")

If you make sure the DLL is registered, and add the Server. to the CreateObject() Method then you should be all working fine.

HTH

-Anthony
0
 
LVL 19

Expert Comment

by:peh803
ID: 12219374
@Anthony -- good catch!!

peh803
0
 
LVL 15

Expert Comment

by:Thogek
ID: 12219543
peh803 likely hit on the right idea.
Also, if AutoTrans is a separate DLL that your VB6 project references, then ASP won't be able to find that same DLL unless it is registered on the Web server, such as peh803 states above (regsvr32 c:\yourpath\AutoTrans.dll).
0
 
LVL 15

Expert Comment

by:Thogek
ID: 12219560
Just to expand slightly on ALaRiva's perfectly good point...
Note that there is a VBScript CreateObject function, and the ASP Server object also has a CreateObject method.  Both do pretty much the same thing -- instantiate an object based on the class name given -- but have different implications as far as where that object's memory is managed.  In most cases, either will work just as well as the other, but Server.CreateObject is usually considered safer within ASP than plain ol' CreateObject.
0
 
LVL 15

Author Comment

by:unknown_routine
ID: 12219816
so please tell me what should EXATLY be written in asp :

This :

<SCRIPT LANGUAGE="VBScript">
Option explicit
Dim objManager

Sub Window_OnLoad()
       <% Server.CreateObject("AutoTrans.Manager") %>      
End Sub

</SCRIPT">

gives me an error.


give me a working code.
0
 
LVL 15

Author Comment

by:unknown_routine
ID: 12219835


<This probably indicates that you're using a class written in the VB App that hasn't been compiled into a DLL and registered on the web application server.>>

is it was not registered how couls i run it in VB without an error???


FYI : web server is on my local machine.
0
 
LVL 10

Expert Comment

by:ALaRiva
ID: 12219923
If you say it's registered then all you needed to do was add the Server. to the CreateObject() Method.

As for your question on 'if it was not registered how could i run it in VB without an error???'
Simple, in VB, you don't necessarily have to register a DLL to use it (depending on what is contained within it) This is evident by the fact that you can just set a reference to the DLL and then have the abilities of Intellisense, etc.  ASP is a completely different thing because you can't set a reference to the object, everything is late-bound in ASP, as opposed to VB6 where you can choose either early or late binding.

Now, I'm wondering why you added some event Subs to the page?  Window_Load?  If you are just trying to execute the code and then redirect after without having to do much, then you don't need anything other than the ASP/VBScript coding.  

Always Start your page with <%@ Language="VBScript" %>
Second line should then be <% Option Explicit %>
Then after that you can just put <% 'Your code here %>
Since you won't be displaying anything and will just be redirecting after, then you don't need <html>,<head>,<body>, etc. tags to the page.

You don't need any Event Subs.

The code will execute when the page is called through a browser.

Give all of that a shot and let us know what's going on.  You can't ask us to give you a full working code when all you have given us or your page is the first couple of lines.  If you have any problems after following the suggestions above, just let us know, and include all pertinent info (error messages if any, what's the problem itself, etc.)

HTH

-Anthony

0
 
LVL 10

Expert Comment

by:ALaRiva
ID: 12219940
Please excuse the comments about not needing to display anything, and just having to redirect, I confused that part with another post I'm assisting on.

My Apologies.

-Anthony
0
 
LVL 15

Author Comment

by:unknown_routine
ID: 12220463
<<in VB, you don't necessarily have to register a DLL to use it (depending on what is contained within it)>>

Not true,
In VB you MUST register a dll to use it, with exception of C++ dlls which can be reached using api functions.

make no mistake, while i'm a begginer in asp, im a VB expert.



I get this error:
"no such interface supported"

The real underlying code is way complecated. Im using COM+ component to do some transactions. but I get above error.


But you dont worry about those thing, as an asp expert you simply give me "Complete" ASP code (including tags) that :

Create  AutoTrans.Manager  class.

I need this for debugging the application.
0
 
LVL 15

Expert Comment

by:Thogek
ID: 12221389
It seems that you already have that code:

    Set objManager = CreateObject("AutoTrans.Manager")
or
    Set objManager = Server.CreateObject("AutoTrans.Manager")

The question is why isn't it working, resulting instead in the error message: Microsoft VBScript runtime error: ActiveX component can't create object: 'AutoTrans.Manager'.

Usually, this message comes from the DLL in question not having been registered on the Web server on which the ASP code is running (as mentioned above).  Given that you've already registered the DLL for use in your VB app, that does not appear to be the problem here.

Another possibility is a security/permissions issue.  If the user account used by ASP (typically IUSR_machinename) does not have access to the COM DLL and all of the dependant DLLs, then ASP won't be able to use it, and may yield this same error message.  (See http://support.microsoft.com/default.aspx?scid=kb;en-us;q194801.)
0
 
LVL 15

Author Comment

by:unknown_routine
ID: 12221523

Note that im a begginer in ASP.

I put this code inside the html:


<%
 Set objManager = server.CreateObject("AutoTrans.Manager")
%>

It says unknown object server !!!  so I assume this i simple ASP grammer error.

All I'm asking you is to give me asp code.

if it then says  ActiveX component can't create object , that's my problem. I know ho to hadndle that.


0
 
LVL 15

Expert Comment

by:Thogek
ID: 12221630
> All I'm asking you is to give me asp code.
We did (and you have it correct above).  The next step is (again) to figure out why it's not working, which we're trying to do.

> It says unknown object server !!!
Hmm.  That's different.  Is that the exact error message you're now getting?  (As opposed to "no such interface supported" you mentioned above, and the original "ActiveX component can't create object" message?)
0
 
LVL 10

Expert Comment

by:ALaRiva
ID: 12221667
Are you sure you are running the code Server-Side?

If you look back at one of my previous replies, you note that I asked why you were using Event Subs?  Window_Load, etc.?

If you are trying to run the coding Client-Side or within the Event Subs, then you might encounter the issues that you are having.

Can you post the source for the page here?  So we can see where you are at with this?

HTH

-Anthony
0
 
LVL 15

Expert Comment

by:Thogek
ID: 12221692
Also, your last code post (from 10/04/2004 11:29AM PDT above) looks a bit confused.  Is that still your current code?

If so,... As ALaRiva asked earlier, what are you trying to accomplish with the Window_OnLoad() client-side subroutine that you would attempt to embed the server-side CreateObject call within it?

If not, could you post more of your ASP/HTML code around your call to CreateObject, so we can see the context of the call?
0
 
LVL 15

Expert Comment

by:Thogek
ID: 12221698
Doh.  I'm echoing people again...
0
 
LVL 10

Expert Comment

by:ALaRiva
ID: 12221766
TWA - Telepathic Web Assistance

We just had our IPs crossed!!! LOL
0
 
LVL 15

Author Comment

by:unknown_routine
ID: 12222080
Im asking the problem in its simplest case:

again:

Question:

We have a dll class named AutoTrans

it has a class named manager

How do you create this class in Server side using ASP. you simply supply full code  for this, including tags.

I think i cant be more clear than this.



0
 
LVL 15

Expert Comment

by:Thogek
ID: 12222105
> How do you create this class in Server side using ASP. you simply supply full code  for this, including tags.

Again, we have already done this.  Repeatedly.

If you're not willing to help us understand your persisting problem by answering our inquiries about it, I don't know how you can expect us to render any more help to you than we already have.
0
 
LVL 15

Author Comment

by:unknown_routine
ID: 12271100
Thanks fritz_the_blank.

Your comment is exactly what I was asking for, when I gave up on the orginal question.


Regards.



0
 
LVL 15

Author Comment

by:unknown_routine
ID: 12272480
As I mentioned this was my secondary quesation. because they failed to aswer the main question.

 I really do not consider any of the questions an answer,  but thank for your complete
secondary solution I will accept one with is a partial type off the above cmment, even if it is far from being an answer.
0
 
LVL 15

Author Comment

by:unknown_routine
ID: 12272728
fritz_the_blank:

Thanks for the info, but please note that I'm also a major contributor to this forum and
are well familiar with the guildlines.
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 12272781
I did note that, and indeed, that is why I am surprised with the tenor of this thread, the final grade you chose to give and etc. and etc.

Fritz the Blank
0
 
LVL 15

Author Comment

by:unknown_routine
ID: 12276846
fritz_the_blank:

The Grade is clearly because I did not recieve an answer to my primary question(including your comment).

I still have to problem and and other questin regarding the primary question remauned unanswered:


"no such interface supported"

nobody explained to to remove this problem.
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 12277119
For what it is worth, that error most frequently appears when the .dll needs to be reregistered or the IUSR_ account does not have the necessary permissions.

0
 
LVL 15

Author Comment

by:unknown_routine
ID: 12278973
ee_ai_construct :

Acting like this simply helps make major contributors like me run away form your forum.

I feel very sorry fot your lack of respect.

Its realy a shame.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 15

Author Comment

by:unknown_routine
ID: 12278988
Yes this was my question:

Dim objManager
Set objManager = CreateObject("AutoTrans.Manager")

I run this code in vb6 runs without a problem.

I run it in an asp page. I get error:

Microsoft VBScript runtime error: ActiveX component can't create object: 'AutoTrans.Manager'


this comment:

Sub Window_OnLoad()
       <% Server.CreateObject("AutoTrans.Manager") %>    
End Sub


did not remove the error.
0
 
LVL 15

Author Comment

by:unknown_routine
ID: 12279011
fritz_the_blank  :

dll is properly registered and has all the permissions.
0
 
LVL 15

Author Comment

by:unknown_routine
ID: 12279025
ee_ai_construct  

<<"no such interface supported" - didn't come up in conversation until nearly the end of this question.>>>

yes this error was not part of originl question, but happend after using the suggestionServer.CreateObject("AutoTrans.Manager") .
0
 
LVL 15

Author Comment

by:unknown_routine
ID: 12279043
To future reader, comment is this thread are not the solution.

I will do a search for the answer.
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 12279057
If you get this figured out, please post the solution. Clearly, despite all of our best efforts, nothing here was to your standards.

FtB
0
 
LVL 15

Author Comment

by:unknown_routine
ID: 12279082
Well , I congraulate to you and your friend for making people accept unaswered questions with grade A!!!!!!
0
 
LVL 15

Author Comment

by:unknown_routine
ID: 12279128
Now I understand why some well respected contribuotor reft this forum.

<< you have any continuing issues with my decision on this question feel quite free to post a question in Community Support where I will be more than pleased to discuss it in detail.>>

Defintily  I have major issues with yiur decision and I will follow this.
0
 
LVL 15

Author Comment

by:unknown_routine
ID: 12279574
fritz_the_blank:

<<If you can show that none of the comments above led to the solution of your problem>>
 
What kind of question is this !!!!  

 As I  have mentioned numerous times none of the comments above led to the solution of the problem

after primary suggestion my error changed into "no such interface supported".

If you have a soultion for this  error, please mention.
0
 
LVL 38

Expert Comment

by:PaulHews
ID: 12280309
unknown_routine,

If you are using the bare bones ASP code suggested by Fritz_the_Blank, and you are still getting the error, then it is likely there is a problem with the DLL; either unable to instantiate with the restricted permissions, or an error in the code itself caused by the restricted environment.

That particular error can be caused by a number of things.  If you have added the dll to a COM+ component, that should fix most of the security problems, as long as you make sure that the account the component runs under has sufficient priviledges to run the same as it would under your VB desktop application.  If you haven't added it as a COM+ component, do so.

Other considerations
-Make sure your compiled dll is set for "unattended execution"
-Make sure you do not call MsgBox anywhere in your code.  User interface elements (forms, controls) are not welcome in the compiled dll.
-If you have any initialization code in the class_initialize event, you should put in some trace code to write to a text file so that you can see if the code is being executed successfully, and where it is failing, if it is.

These things can be tricky to debug.
0
 
LVL 38

Expert Comment

by:PaulHews
ID: 12280338
What is your OS, by the way?
0
 
LVL 19

Expert Comment

by:peh803
ID: 12280714
fine with me..

peh803
0
 
LVL 15

Author Comment

by:unknown_routine
ID: 12280771
Yes trciky to debug, That's why I asked it hopeful for solution.


My OS is Windows 2000 server.

<<make sure your compiled dll is set for "unattended execution">>

it is set for unattended execution.


<<Make sure you do not call MsgBox anywhere in your code. >>

 PaulHews: I have no idea why someone should call a message box in a dll??!!!


<<If you have added the dll to a COM+ component, that should fix most of the security problems, >>

Yes dll is already a part of COM+ appllication.


<<If you have any initialization code in the class_initialize event,>>

No I dont have any code at this time in the ini sub.

<<sure that the account the component runs under has sufficient priviledges >>

Account is system Admin.


<<either unable to instantiate with the restricted permissions, or an error in the code itself caused by the restricted environment.>>

none of these seems to be the issue, Im doing more research and the isuue seems to be a microsofot bug when using MTCtrasacion property of dlls
set to required.

If you have other solutions please mention.







0
 
LVL 32

Expert Comment

by:jadedata
ID: 12280830
0
 
LVL 38

Expert Comment

by:PaulHews
ID: 12280964
You will need to set the transaction property of the page.  Change the base code like this:

<%@ TRANSACTION=Required %>
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
</HEAD>
<BODY>
<%
Dim objManager
Set objManager = Server.CreateObject("AutoTrans.Manager")
%>
</BODY>
</HTML>
This way all objects created will run under the same transactional context.
http://www.microsoft.com/windows2000/en/server/iis/htm/asp/dire5t0u.htm
0
 
LVL 15

Author Comment

by:unknown_routine
ID: 12282052
PaulHews:

FYI:

Im not dealing with transaction in ASP pages.  The Transaction happens in COM+  using MTC.

User level(ASP) level transaction is not needed here.
0
 
LVL 15

Author Comment

by:unknown_routine
ID: 12282108
jadedata:
The link you provided is deal with NT4 is useless  in my question.
MTS is part of COM+ in 2000,  and it is not directly dealt with.

Sorry , but I feel I get better chance finding the solution through research myself than
further following this thread.
0
 
LVL 38

Expert Comment

by:PaulHews
ID: 12286569
Post your answer when you find it.  Sounds like it would be a good addition to the PAQ.
0
 
LVL 32

Expert Comment

by:jadedata
ID: 12287050
Here are some fairly good tutorial links with MTS/COM+/2000 info

http://authors.aspalliance.com/stevesmith/articles/20000614asptoday.asp
http://tutorials.beginners.co.uk/read/id/197

and a bonus
  "Creating Objects Properly in an MTS App"
  http://www.microsoft.com/mind/0899/Basics/Basics0899.asp
0
 
LVL 15

Author Comment

by:unknown_routine
ID: 12287418
jadedata  feedback:

Thanks for the links,

However I do not need a tutorial for using COM+ !!!!

I'm well familiar with COM+ and have been using it in industry level.
0
 
LVL 32

Expert Comment

by:jadedata
ID: 12291896
Well the high level stuff isn't working so I figured that a trip back to the basics might be in order.
0
 
LVL 10

Expert Comment

by:thefritterfatboy
ID: 12399030
Dagnammit - what the hell is this error? I've stripped all my interfaces off and left a shell of a COM component to try and get it working and I'm STILL getting this error!


unknown_routine: have you had any luck with this yet? At first I had trouble with permissions, now that has gone I'm left with this EVER-SO-HELPFUL error message.

Server object error 'ASP 0177 : 80004002'

Server.CreateObject Failed

/script_name.asp, line 4

No such interface supported

Nobody tell me to register it. I've had enough of people telling me to do that. "Invalid ProgID" is the error you get when the DLL is not registered.


SOMEBODY must know! (I'm sure it'll be simple, too!)
0
 
LVL 15

Author Comment

by:unknown_routine
ID: 12404615
Unfortunatly I have no solution for this at this time.

What makes this complicated is that, when I set MTSTransactioMode property to
RequiresTransaction and UsesTransction  The error goes away and reapears from time to time.

Anothertime it gives that error in both conditions.

My OS is SQL Server 2000 Advanced Server. I login as admin.

How about you ? OS? User?

The bad thing is that im a newbie in terms of Network and I guess the solution is inside a good understading of Active  Directory and DNS and DC.

Please elaborate what environment you are in.

I will update you if I come to any solution.




0
 
LVL 10

Expert Comment

by:thefritterfatboy
ID: 12408518
Win 2000 Environment to test. (I'm hoping to release on a Win 2003 Enterprise Server.)

I'm logged in as a standard user, but the COM object should work regardless. It merely connects to a pop3 server and uses the IIS out-of-process user accounts when called from ASP.
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 12746141
I strongly advise against a refund here. I recommend a split between ALaRiva  and peh803.

FtB
0
 
LVL 15

Author Comment

by:unknown_routine
ID: 12754531
thefritterfatboy:

I have not found the solution for this yet. commuicating with the microsoft did not gave an answer.

To future reader:

None of the above comments are not  an answer to the problem/bug .

To Admin: We have been through this before , I strongly disagree any comments  be accepted
as an answer, simply because none of them are not answers.

I don't care if you delete, split, ..... but this will be highly misleading if you accpet this specialy with grade A, B.

The best way seems to be grade C,  or delete.
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 12781722
PAQed with points refunded (300)

modulo
Community Support Moderator
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now