Link to home
Start Free TrialLog in
Avatar of jpbivona
jpbivona

asked on

Call a .NET component from an ASP page - Error: Server.CreateObject Failed - 800401f3

I am trying to call a server object (.dll) that I created in VB (VS 2005) from an .ASP page.
I am getting the following error:

Server object error 'ASP 0177 : 800401f3'

Server.CreateObject Failed

/tiweb80/scripts/TIWebPortal/newWorkOrder.asp, line 329

800401f3

My asp code:
Dim Obj
Set Obj = Server.CreateObject("ClassLibraryPrintWorkOrder.PreparePrint")
Obj.Print(rsWorkOrder("WOID").value)

I built a VB Class Library following the instructions here: http://www.codeproject.com/useritems/dotnetcomponentandasp.asp

Can anyone help me troubleshoot this?

Thanks.
ASKER CERTIFIED SOLUTION
Avatar of L00M
L00M
Flag of United States of America image

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 jpbivona
jpbivona

ASKER

Yes, I ran sn with /codebase to create the tlb file.

Could you explain this more or what steps I should take to verify?

" Also, if the ID specified for the anonymous user in IIS doesn't match the ID of the user the com+ client was exported to impersonate, it will show that error. "
Also how can I be sure my asp page can find my dll?

Does it need to be in the same directory?

I put it in a directory called bin. I didn;t register the dll, because I didn't think it was necessary (regsvr32 myObject.dll)
jp,
It's been a few years since I've done this. Lemme parallel you in doing sdome research. Hopefully some other experts can pitch in.
Ok....when I run the following I get a return of 'True' for file found, but then a CreateObject Error:

  Dim fileObject
       Set fileObject = Server.CreateObject("Scripting.FileSystemObject")
       Response.write fileobject.FileExists("C:\Program Files\Numara Software\Numara Track-It! 8\Web Add-On\Web\Scripts\TIWebPortal\ClassLibraryPrintWorkOrder.dll")

        Dim Obj
        Set Obj = Server.CreateObject("ClassLibraryPrintWorkOrder.Class1")
        Obj.Print(rsWorkOrder("WOID").value)
       
I believe that I am calling it correctly, here is code from my class1.vb file:
Imports System.IO
Imports System.Data
Imports System.Data.Sql
Imports System.Data.SqlTypes
Imports Microsoft.SqlServer.Server
Imports System.EnterpriseServices

<Assembly: ApplicationName("ClassLibraryPrintWorkOrder")>
<Assembly: ApplicationActivation(ActivationOption.Server)>
<Assembly: ApplicationAccessControl(False, AccessChecksLevel:=AccessChecksLevelOption.ApplicationComponent)>

Public Class Class1
 <Microsoft.SqlServer.Server.SqlProcedure()> _
Public Sub Print(ByVal wid As Int32)

--More Code---

End Sub
UPDATE

I have found the following solutions to be beneficial:
https://www.experts-exchange.com/questions/21615143/Server-object-ASP-0177-0x800401F3-Invalid-Class-String.html
https://www.experts-exchange.com/questions/21615548/VB6-IIS-XP-Pro-SP2-DLL-error-in-ASP-page.html

MY PROBLEM IS:
After I build my .dll from Visual Studio 2005 I do not see my dll in the registry. I am trying to build the dll on a dev machine (with success) and then copy it to a webserver to instantiate from....how to I properly register my dll?

Anyone? Thanks.
SOLUTION
Avatar of b0lsc0tt
b0lsc0tt
Flag of United States of America image

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
I just noticed your last posts.  My window had sat for a bit.  Hopefully the answer to your latest question is in my first paragraph.  Let me know if you have a question.

bol
b0lscott,

Yes, please give me the steps to try this test.....

Can you run the code locally (i.e. in a VBS file)?  Does the object get created when tried that way?

Let me know if you have a question about any step or how this works.
I am now getting this error when I try to call a function from the .dll I compiled: (And I can see it in the registry)

ERROR:
ClassLibraryPrintWorkOrder error '80004003'

Object reference not set to an instance of an object.

VB CLASS CODE:
Imports System.IO
Imports System.Data
Imports System.Data.Sql
Imports System.Data.SqlTypes
Imports Microsoft.SqlServer.Server
Imports System.EnterpriseServices
<Assembly: ApplicationName("ClassLibraryPrintWorkOrder")>
<Assembly: ApplicationActivation(ActivationOption.Server)>
<Assembly: ApplicationAccessControl(False, AccessChecksLevel:=AccessChecksLevelOption.ApplicationComponent)>
Public Class Class1
Public Function Print() As String
Dim pr As String = System.Configuration.ConfigurationManager.AppSettings("PrinterName").ToString
Return pr
End Function
End Class

ASP CODE:
Dim Obj
Dim val
Set Obj = Server.CreateObject("ClassLibraryPrintWorkOrder.Class1")  
val = Obj.Print()
Response.Write(val)


SOLUTION
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
I'm glad I could help.  Thanks for the grade, the points and the fun question.

bol
Likewise. Wish I could have helped more.