Link to home
Start Free TrialLog in
Avatar of Shiju S
Shiju SFlag for United States of America

asked on

Asp Com compnent Error-- 0192 (0x80004005)

Hi Experts
   i am developing a server Com component using VB
but when i execute this, i get an error on ASP page like this
'===============================================
ASP 0192 (0x80004005)
A trappable error occurred in the OnEndPage method of an external object.
'===============================================
i am creating  an object
         Server.CreateObject("MyCom.MyClass")  <--- This is another dll, registered on server
in my Com component code. this is causing the problem.
i traced MyCom.MyClass by placing code to write data to a file in some places in MyClass
and i found that control is passing throgh right path.
but after execution it returns this error.

Thanks in Advance
Shiju

Avatar of Shiju S
Shiju S
Flag of United States of America image

ASKER

'''''''''''''''''Here is my Component Code ''''''''''''''''''''
'        Project Name  - MyProject
'        Class Name    - TestClass
'==============================================================

Private Response As ASPTypeLibrary.Response
Private Request As ASPTypeLibrary.Request
Private Application As ASPTypeLibrary.Application
Private Server As ASPTypeLibrary.Server
Private Session As ASPTypeLibrary.Session
Dim objLink

Public Sub OnStartPage(SC As ScriptingContext)
    Set Session = SC.Session()
    Set Response = SC.Response()
    Set Request = SC.Request()
    Set Server = SC.Server()
    Set Application = SC.Application()
End Sub
 
Public Sub OnEndPage()
    Set Session = Nothing
    Set Response = Nothing
    Set Request = Nothing
    Set Server = Nothing
    Set Application = Nothing
End Sub
Public Sub MySub()
On Error GoTo Last:
'-------- If i Remve these statements it works    -----
    Set objLink = Server.CreateObject("MyCom.MyClass") '<--- This is another dll
                                                     'which is registered on the server
    CallByName objLink, "TestValue", VbLet, "Test Value"
    CallByName objLink, "Show", VbMethod
    Set objLink = Nothing
'--------
Last:
If Err.Number <> 0 Then
    EventLog "C:\MainSub.txt", 6, , Err.Description
    Err.Clear
End If
End Sub
'==============================================================
Avatar of Shiju S

ASKER

>>EventLog "C:\MainSub.txt", 6, , Err.Description
simply writes error messge to a file
Avatar of Shiju S

ASKER

'''''''''''''''''Here is my ASP Code ''''''''''''''''''''

<%
      Dim objCOM
      Set objCom = Server.CreateObject("MyProject.TestClass")
      objCom.MySub
      Set objCom = Nothing
%>
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
i hope this solves the problem

Public Sub MySub()
On Error GoTo Last:
'-------- If i Remve these statements it works    -----
Dim objLink As MyCom.MyClass
    Set objLink = New  MyClass


'   just make sure is this syntax  correct --> CallByName objLink, "TestValue", VbLet, "Test Value"
' we usually call functions as objLink.functionname(parameteres)
    CallByName objLink, "TestValue", VbLet, "Test Value"
    CallByName objLink, "Show", VbMethod
    Set objLink = Nothing
'--------
Last:
If Err.Number <> 0 Then
    EventLog "C:\MainSub.txt", 6, , Err.Description
    Err.Clear
End If
End Sub
Avatar of Shiju S

ASKER

hi
thank u for the comment
>> we usually call functions as objLink.functionname(parameteres)
           objLink.TestValue = "Test Value"
           objLink.Show
yes, i tried that already but got the same error.
control passes through all these lines but at the end i get this error  Error-- 0192 (0x80004005)
pls help...
ASKER CERTIFIED SOLUTION
Avatar of sreeganesh
sreeganesh

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Shiju S

ASKER

Hi sreeganesh
  Thank u for the comment
 i tried ur idea, but that doesnt seem to work.
MS suggests you use ObjectContext instead of OnStartPage/OnEndPage

Creating Visual Basic COM Components for ASP
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iissdk/html/503e9edf-489c-4e54-a076-4c519ef6a649.asp


If you don't want to commit to going the ObjectContext way, I would also consider trying the following:

-Leaving out the OnEndPage event... These object references will end when the component is set to Nothing in your ASP page.  See this: http://www.devx.com/vb2themax/Tip/18457

-Renaming your objects
Private mResponse As ASPTypeLibrary.Response
Private mRequest As ASPTypeLibrary.Request
Private mApplication As ASPTypeLibrary.Application
Private mServer As ASPTypeLibrary.Server
Private mSession As ASPTypeLibrary.Session

It's usually not a good idea to name a variable after a global class.
Avatar of Shiju S

ASKER

hi
@PaulHews
    Thank u, those links were helpful

@sreeganesh
  Thank u ,  u were right , iis was not releasing the things when i tried.
it got right when i stopped iis completely tried with modified dll
reregistration did the job

Thank u all

;-)
Shiju