[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2638
  • Last Modified:

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.
0
jpbivona
Asked:
jpbivona
  • 6
  • 4
  • 3
3 Solutions
 
L00MCommented:
Are you sure you added /codebase on the end of the regasm command and ran sn.exe successfully?
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.  By setting the id's the same, classic asp will have access rights to creating the com+ object.
0
 
jpbivonaAuthor Commented:
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. "
0
 
jpbivonaAuthor Commented:
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)
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
L00MCommented:
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.
0
 
jpbivonaAuthor Commented:
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
0
 
jpbivonaAuthor Commented:
UPDATE

I have found the following solutions to be beneficial:
http://www.experts-exchange.com/Web/Web_Languages/ASP/Q_21615143.html
http://www.experts-exchange.com/Programming/Languages/Visual_Basic/Q_21615548.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.
0
 
b0lsc0ttCommented:
You should need to register the DLL.  Do that and try again (e.g. regsvr32 [pathtofile\dllname.dll]).  If you type the command in the folder with the dll then you can leave off the pathtofile part and just type your file name.

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.

bol
0
 
b0lsc0ttCommented:
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
0
 
jpbivonaAuthor Commented:
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.
0
 
jpbivonaAuthor Commented:
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)


0
 
b0lsc0ttCommented:
>> Yes, please give me the steps to try this test <<

In many cases you just take your code and save the file as a .vbs file (vbs extension).  This can usually be run from the Run prompt or a DOS prompt.  There is some helpful, general info on this at http://www.windowsdevcenter.com/pub/a/oreilly/windows/news/vbscriptpr_0201.html.  Let me know if you have a question about this or need more info.

You might be pass the point of the response above.  I noticed the recent post but that seems to be an object error more than one because of server setup.  That part is getting out of my expertise though.  You could still try to run the file locally as a VBS file or using WSH.  If it works that way then it is probably an IIS issue.

I hope this helps.  Let us know the results or if you have any questions.

bol
0
 
b0lsc0ttCommented:
I'm glad I could help.  Thanks for the grade, the points and the fun question.

bol
0
 
L00MCommented:
Likewise. Wish I could have helped more.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 6
  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now