.NET 2.0 doesn't support COM+ for late binding? .NET2.0 COM+ for VB6 client.

goodmorningsky

Centurion
Joined
Aug 18, 2003
Messages
172
Hi all,

Since our project have to support legacy VB6 client also, I created COM+ using .NET.
First time I create COM+ using .NET 1.1 version.
VB6 client calls the COM+ Application class and calls Exectue4VB() method.
There was no problem. I test it all and worked as expected.

We decided to convert COM+ code using .NET 2.0.
However when I converted the code to .NET2.0, it stops work!!

So, I created small test COM+ and test vb6 client.
It doesn't work. It works perfectly ok with COM+ written in .NET1.1.
Error is : Object doesn't support this property or method



It's so wired. What is problem? .NET2.0 doesn't support it anymore or what?
It's same code. I've searched all around to find related doc. I couldn't find any.
Any comment helps.


Thank you all.

Here is sample code:
Code:
using System;
using System.Collections.Generic;
using System.Text;
using System.EnterpriseServices;
using System.Runtime.InteropServices;
namespace DLSBPM2.Engine
{

[Description("COM+ class.")]

[ClassInterface(ClassInterfaceType.None)]

[ObjectPooling(Enabled=true, MinPoolSize=4, MaxPoolSize=4)]

[Guid("F72E9E0F-CDFF-49A4-858F-889F868DB7F5")]

public class Application : System.EnterpriseServices.ServicedComponent {

         public Application()
         {
         }



        public object Execute4VB(object objs)
        {
          return "" + objs + ":" + DateTime.Now.ToLongTimeString();
        }
}
}
// I added to COM+ like following
Code:
regasm DLSBPM2.Engine.dll /tlb DLSBPM2.Engine.tlb
gacutil /i DLSBPM2.Engine.dll
regsvcs /tlb:DLSBPM2.Engine.tlb DLSBPM2.Engine.dll

//And VB6 client Code sample
Code:
Option Explicit

Private Sub Command1_Click()
    Dim myApplication As Object
    Set myApplication = CreateObject("DLSBPM2.Engine.Application", "myserver")
    Dim result
    ' following line of code throw Error with .NET2.0 COM+
    ' : Object doesn't support this property or method
    result = myApplication.Execute4VB("this is test")
    MsgBox result
End Sub
 
Solution

I resolved the issue.

I changed ClassInterfaceType to AutoDispatch and it solves it like following.

[ClassInterface(ClassInterfaceType.AutoDispatch)]

The problem started from .NET1.1.

Since ClassInterfaceType.None shouldn't work in .NET1.1 even.
However, somehow they changed something or fixed bug in .NET2.0 and it stop work with None for Late binding client.
That's why it confued me.


Anyhow, thank you all.
 
Back
Top