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/TIWebPort al/newWork Order.asp, line 329
800401f3
My asp code:
Dim Obj
Set Obj = Server.CreateObject("Class LibraryPri ntWorkOrde r.PrepareP rint")
Obj.Print(rsWorkOrder("WOI D").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.
I am getting the following error:
Server object error 'ASP 0177 : 800401f3'
Server.CreateObject Failed
/tiweb80/scripts/TIWebPort
800401f3
My asp code:
Dim Obj
Set Obj = Server.CreateObject("Class
Obj.Print(rsWorkOrder("WOI
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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)
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.
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.
ASKER
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("Scrip ting.FileS ystemObjec t")
Response.write fileobject.FileExists("C:\ Program Files\Numara Software\Numara Track-It! 8\Web Add-On\Web\Scripts\TIWebPo rtal\Class LibraryPri ntWorkOrde r.dll")
Dim Obj
Set Obj = Server.CreateObject("Class LibraryPri ntWorkOrde r.Class1")
Obj.Print(rsWorkOrder("WOI D").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("ClassLibr aryPrintWo rkOrder")>
<Assembly: ApplicationActivation(Acti vationOpti on.Server) >
<Assembly: ApplicationAccessControl(F alse, AccessChecksLevel:=AccessC hecksLevel Option.App licationCo mponent)>
Public Class Class1
<Microsoft.SqlServer.Serve r.SqlProce dure()> _
Public Sub Print(ByVal wid As Int32)
--More Code---
End Sub
Dim fileObject
Set fileObject = Server.CreateObject("Scrip
Response.write fileobject.FileExists("C:\
Dim Obj
Set Obj = Server.CreateObject("Class
Obj.Print(rsWorkOrder("WOI
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("ClassLibr
<Assembly: ApplicationActivation(Acti
<Assembly: ApplicationAccessControl(F
Public Class Class1
<Microsoft.SqlServer.Serve
Public Sub Print(ByVal wid As Int32)
--More Code---
End Sub
ASKER
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.
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
bol
ASKER
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.
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.
ASKER
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("ClassLibr aryPrintWo rkOrder")>
<Assembly: ApplicationActivation(Acti vationOpti on.Server) >
<Assembly: ApplicationAccessControl(F alse, AccessChecksLevel:=AccessC hecksLevel Option.App licationCo mponent)>
Public Class Class1
Public Function Print() As String
Dim pr As String = System.Configuration.Confi gurationMa nager.AppS ettings("P rinterName ").ToStrin g
Return pr
End Function
End Class
ASP CODE:
Dim Obj
Dim val
Set Obj = Server.CreateObject("Class LibraryPri ntWorkOrde r.Class1")
val = Obj.Print()
Response.Write(val)
ERROR:
ClassLibraryPrintWorkOrder
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("ClassLibr
<Assembly: ApplicationActivation(Acti
<Assembly: ApplicationAccessControl(F
Public Class Class1
Public Function Print() As String
Dim pr As String = System.Configuration.Confi
Return pr
End Function
End Class
ASP CODE:
Dim Obj
Dim val
Set Obj = Server.CreateObject("Class
val = Obj.Print()
Response.Write(val)
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I'm glad I could help. Thanks for the grade, the points and the fun question.
bol
bol
Likewise. Wish I could have helped more.
ASKER
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. "