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 ... ]