I'm trying to use COM Interop for the first time, and I can't quite get it
all to work on my server. I have a COM Object that needs to call my .NET dll
to encrypt a file. Then that file needs to be written to the web server.
When I put the .NET dll in the same directory as my COM dll on my local
machine, the process works. When I put the .NET dll in the same directory as
the COM object on the web server & register the .NET dll with regasm, I get
VBRuntime errors like:
Action CreateObject for Encryption.COMEncryption failed.
Err.Source: clg_ftp
Err.Number: -2147024894
Err.Description: File or assembly name Encryption, or one of its
dependencies, was not found.
Here's the code I use to call my .NET dll from the COM object:
Set objEnc = CreateObject("Encryption.COMEncryption")
EncryptError = objEnc.TripleDESEncryptFile("myKeyString", vFileName,
vFileName & ".encrypt")
Set objEnc = Nothing
Am I missing a permission setting somewhere? What can I do to make the COM
object recognize the .NET dll on the server? Any help is greatly appreciated!
Thanks!
Todd Beaulieu - 22 Nov 2005 16:17 GMT
I believe the deal is as follows:
1. Use the "Register for COM Interop" option when compiling. This will do
two things: 1) create the required TLB file and 2) Auto-register it ON YOUR
DEVELOPMENT MACHINE.
2. In the VB 6 app, reference the TLB. Compile.
3. On the remote box. Register the TLB using standard COM techniques.
4. Might have to use RegAsm to register the DLL itself with interop
services.
This all assumes you're not simply missing some other component that your
DLL references. Check the references in the DLL and make sure any dependant
DLLs/TLBs are on the server.
va_acharya - 24 Nov 2005 09:33 GMT
I think it is not the problem of interop ... once just for testin
purpose please call your .net Class from a .net application only an
then check that you are getting the same error or not.
In case you donot get any error please let me know the steps yo
followed to generate or register your .Net class as Com object.
Here is the best way for exposing your .Net class as Com object
[ClassInterface(ClassInterfaceType.AutoDispatch)]
[ProgId("MilkQuality.Report")]
public class Report : System.Windows.Forms.UserControl
{
--
va_achary
j-integra_support@intrinsyc.com - 24 Nov 2005 21:25 GMT
The following KB article contains instructions for creating a COM
Interop "wrapper" for a .NET DLL. The article is actually explaining
how to access .NET DLLs from Java clients, but the steps are the same
for creating the COM wrapper (even if you are using VB as the client
language).
Accessing .NET Components From a Java Client (78813)
http://j-integra.intrinsyc.com/support/com/kb/article.asp?article=78813
Shane Sauer
J-Integra Interoperability Solutions
http://j-integra.intrinsyc.com/
high performance interop middleware for java, corba, com & .net