1
votes

I have been working on this for days and made progress but it is still not working the way I need it to.

First off this project is taking an existing huge site (100,000+ lines of code spread out over at least 200+ files) written in classic asp (vbscript) and converting to .NET framework.

The existing code uses VBScript classes, for the most part, and my plan is to make a mimic of the dozen or so classes that are already defined into a .NET assembly that both the new .NET version and the existing Classic ASP pages can use - through COM+.

I have made the first class definition, replicated in .NET and it works in my Test.ashx page on the development server (when I go to the page in my browser, I get the expected output). But I receive an error calling it from the Test.asp page Server object error 'ASP 0177 : 80004003' on the line that calls set obj = server.CreateObject("MyLibrary.MyClass").

I have registered the custom DLL via regasm like this regasm "C:\inetpub\siteroot\bin\MyLibrary.dll" /tlb /codebase and it seemed to work fine (the library appears in the server's Component Services as expected with the methods defined and everything seems fine.

My gut is telling me that it is either a 32-bit/64-bit problem or a permissions problem. I have tried a number of different things over the days that are too numerous to recount, but any suggestions would be greatly appreciated.

NOTES:

  • The server is running Windows Server 2012 R2
  • I used PowerShell to add the custom dll to the GAC.
  • I am using the 32-bit version of regasm. I tried the 64-bit version, but when doing that, both sides (.NET and Classic) error out.
  • The IIS Application Pool that the site uses has 32-bit enabled and apparently has to stay that way because of some other 3rd-party COM object the site uses.
  • The properties on the ComClass Project
    • Compile: Register for COM interop is checked. Target CPU is "Any CPU"
    • Application: Target framework set to .NET Framework 4.5
    • Application: Application type set to Class Library
    • Application, Assembly Information: Make assembly COM-Visible is checked
  • I added a Reference in the main site project to the MyLibrary.dll compiled by the ComClass project

The top portion of the .vb file for this first class is as follows

Imports System
Imports System.Web
Imports System.Web.HttpContext
Imports System.String
Imports System.Data
Imports System.Data.SqlClient
Imports System.Configuration
Imports System.Runtime.InteropServices
Imports System.EnterpriseServices

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

<ComClass(MyClass.ClassId, MyClass.InterfaceId, MyClass.EventsId), ProgId("MyLibrary.MyClass")>
Public Class MyClass
    Inherits ServicedComponent
    [GUIDS]
    [subs and functions ... ]
1
I finally did find a reference list of asp error codes that says that 80004003 is an "Invalid pointer" which indicates to me that the name is not getting set correctly.Richard Markette
BTW: I get this same error when running a .vbs file with Windows Scripting Host. The 64-bit version gives the Invalid Pointer error. The 32-bit version gives the Cannot Create ActiveX Object.Richard Markette
Something else I have discovered is that the Component Services snap-in, when browsing the custom class library application and viewing the included "Components" only lists one class. The project that builds the DLL actually has two classes in it (when in VS, I can use either MyLibrary.MyClass or MyLibrary.ComClass) - but after regasm does its thing, only MyClass shows up in the Component Services snap-in.Richard Markette

1 Answers

1
votes

I finally got it working... all the different things I tried apparently was preventing me for seeing any of the changes I was making in my further attempts. I say this because today I tried starting over - I went onto the server and cleaned the registry of all occurrences of my assembly's name and I removed it from GAC, everywhere I could think of.

Then on my local computer I used Visual Studio to "Publish" the website that references the custom DLL. It instantly worked on my Test.ashx page. So then I registered the DLL using regasm (64-bit) as before and boom it worked on the ASP side too!

I did not receive any suggestions but thank you to anyone who gave this any thought.