• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1362
  • Last Modified:

Can not create object!

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
unknown_routine
Asked:
unknown_routine
  • 23
  • 7
  • 5
  • +6
1 Solution
 
peh803Commented:
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
 
ALaRivaCommented:
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
 
peh803Commented:
@Anthony -- good catch!!

peh803
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
ThogekCommented:
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
 
ThogekCommented:
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
 
unknown_routineAuthor Commented:
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
 
unknown_routineAuthor Commented:


<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
 
ALaRivaCommented:
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
 
ALaRivaCommented:
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
 
unknown_routineAuthor Commented:
<<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
 
ThogekCommented:
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
 
unknown_routineAuthor Commented:

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
 
ThogekCommented:
> 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
 
ALaRivaCommented:
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
 
ThogekCommented:
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
 
ThogekCommented:
Doh.  I'm echoing people again...
0
 
ALaRivaCommented:
TWA - Telepathic Web Assistance

We just had our IPs crossed!!! LOL
0
 
unknown_routineAuthor Commented:
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
 
ThogekCommented:
> 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
 
unknown_routineAuthor Commented:
Thanks fritz_the_blank.

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


Regards.



0
 
unknown_routineAuthor Commented:
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
 
unknown_routineAuthor Commented:
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
 
fritz_the_blankCommented:
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
 
unknown_routineAuthor Commented:
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
 
fritz_the_blankCommented:
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
 
unknown_routineAuthor Commented:
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
 
unknown_routineAuthor Commented:
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
 
unknown_routineAuthor Commented:
fritz_the_blank  :

dll is properly registered and has all the permissions.
0
 
unknown_routineAuthor Commented:
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
 
unknown_routineAuthor Commented:
To future reader, comment is this thread are not the solution.

I will do a search for the answer.
0
 
fritz_the_blankCommented:
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
 
unknown_routineAuthor Commented:
Well , I congraulate to you and your friend for making people accept unaswered questions with grade A!!!!!!
0
 
unknown_routineAuthor Commented:
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
 
unknown_routineAuthor Commented:
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
 
PaulHewsCommented:
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
 
PaulHewsCommented:
What is your OS, by the way?
0
 
peh803Commented:
fine with me..

peh803
0
 
unknown_routineAuthor Commented:
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
 
jadedataMS Access Systems CreatorCommented:
0
 
PaulHewsCommented:
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
 
unknown_routineAuthor Commented:
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
 
unknown_routineAuthor Commented:
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
 
PaulHewsCommented:
Post your answer when you find it.  Sounds like it would be a good addition to the PAQ.
0
 
jadedataMS Access Systems CreatorCommented:
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
 
unknown_routineAuthor Commented:
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
 
jadedataMS Access Systems CreatorCommented:
Well the high level stuff isn't working so I figured that a trip back to the basics might be in order.
0
 
thefritterfatboyCommented:
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
 
unknown_routineAuthor Commented:
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
 
thefritterfatboyCommented:
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
 
fritz_the_blankCommented:
I strongly advise against a refund here. I recommend a split between ALaRiva  and peh803.

FtB
0
 
unknown_routineAuthor Commented:
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
 
moduloCommented:
PAQed with points refunded (300)

modulo
Community Support Moderator
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 23
  • 7
  • 5
  • +6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now