0
votes

I have create a class library in C# and compiled as a dll. I added a website to the solution and have no issue with calling the methods in the dll from asp.net. However, when I try to use it in classic asp using Server.CreateObject I get the error "Server.CreateObject Failed".

I have read everything I can find. I have done the following:

  1. Went to Properties->Build and checked "Register for COM Interop"
  2. In the assembly.cs fine I added [assembly: ComVisible(true)]
  3. In the class I added

    [ComVisible(true)] [ClassInterface(ClassInterfaceType.None)] [Guid("2CDBF7B7-BD43-4B64-BB81-8591CB259065")]

  4. I generated and added GUIDs

  5. I generated and refernce snk in assembly.cs

I am going to continue to research but considering my time constraints I am hoping someone has a solution to this problem.

I have read you register a .net dll for use in classic using RegAsm but the server does not have RegAsm and cannot be installed. I must register using RegSvr32 but when I try that I get the error "DllRegisterServer entry point was not found".

If you have a solution that works please share. I have been googling for days and tried everything I have found but nothing is working.

1
An alternate approach would be to interface with this new code as a web service instead of trying to embed the logic directly in your classic asp page(s). If your production server is capable of running the .NET environment that this DLL needs, then you should be able to configure your IIS site to support both the classic ASP and ASP.NET components simultaneously. The simplest interface might be to use an ASHX as the .NET side of the service and call it using Microsoft.ServerXMLHTTP component from your classic ASP page(s).user2638401

1 Answers

0
votes

You'll need to add the DllRegisterServer in your code, here's an example https://limbioliong.wordpress.com/2011/08/11/programmatically-register-com-dlls-in-c/

Re-build, then call regsvr32 on the resulting .NET DLL

Finally call the .DLL from your ASP project.