goodmorningsky Posted September 14, 2006 Posted September 14, 2006 (edited) Hi, all. I have problem with COM+. I created COM+ with C#.NET. I have to call this COM+ from window application(in C#.net) remotely using late or early binding. I called COM+ with late binding, it throws 'Method not found' exception. And I don't know how to do early binding. I didn't have problem to calling COM+ written in VB. I add reference from COM tab. It works ok. However, when I try to add reference of COM+ written in C# from COM tab, it throws error message, "A reference to 'COMPlusServer2003' could not be added. Converting the type library to a .NET assembly failed. Type library COMPlusServer2003 was exported from a CLR assembly and can not be re-imported as a CLR assembly." I tried to add reference from just .NET tab or browsing the dll. It works with locally, but doesn't work with remotely. I've searched any source code or help over web. I've found only about how to make COM+. I couldn't find how to create client calling the .net COM+ remotely. Here is the code, using System; using System.EnterpriseServices; namespace COMPlusServer2003 { [Transaction(TransactionOption.Required)] [ObjectPooling(Enabled=true, MinPoolSize=4, MaxPoolSize=4)] public class Bank : System.EnterpriseServices.ServicedComponent { public Bank() { } [AutoComplete] public int Add(int i1, int i2) { return i1 + i2; } } } AssemblyInfo is [assembly: AssemblyDelaySign(false)] [assembly: AssemblyKeyFile("..\\..\\COMPlusServer2003.snk")] [assembly: AssemblyKeyName("")] [assembly: ApplicationName("COMPlusServer2003.COMPlusServer2003")] [assembly: ApplicationActivation(ActivationOption.Server)] [assembly: ApplicationAccessControl(false, Authentication=AuthenticationOption.None)] And client app is: //Testing Late binding private void button3_Click(object sender, EventArgs e) { System.Type type = System.Type.GetTypeFromProgID("COMPlusServer2003.Bank", "remoteComputer01", true); object app = System.Activator.CreateInstance(type); object[] args = {1, 2}; object result = type.InvokeMember("Add", System.Reflection.BindingFlags.InvokeMethod, null, app, args); //Method 'System.__ComObject.Add' not found. Exception is thrown MessageBox.Show(result.ToString()); } //Testing Early Binding //On local, my development computer where server COMPlusServer2003.Bank is. It works ok. private void button4_Click(object sender, EventArgs e) { System.Type type = System.Type.GetTypeFromProgID("COMPlusServer2003.Bank", "w2kpro3", true); COMPlusServer2003.Bank app = (COMPlusServer2003.Bank)System.Activator.CreateInstance(type); int result = app.Add(1, 2); MessageBox.Show(result.ToString()); } Early Binding code throws error when the application calls from other machine remotely. I did installed the proxy(created by Exporting it from the server COM+) on the other machine before launching the client. I have no idea! It should work. Please help. I couldn't find any help from any article including msdn.. Any comment will help! Edited September 14, 2006 by PlausiblyDamp Quote Sun Certified Web component Developer, Microsoft Certified Solution Developer .NET, Software Engineer
Recommended Posts