Jump to content
Xtreme .Net Talk

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


Recommended Posts

Posted

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:

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


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

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

Sun Certified Web component Developer,

Microsoft Certified Solution Developer .NET,

Software Engineer

Posted

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.

Sun Certified Web component Developer,

Microsoft Certified Solution Developer .NET,

Software Engineer

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...