goodmorningsky
Well-known member
- Joined
- Aug 18, 2003
- Messages
- 172
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 dont know how to do early binding. I didnt 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 doesnt work with remotely.
Ive searched any source code or help over web. Ive found only about how to make COM+. I couldnt find how to create client calling the .net COM+ remotely.
Here is the code,
And client app is:
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 couldnt find any help from any article including msdn..
Any comment will help!
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 dont know how to do early binding. I didnt 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 doesnt work with remotely.
Ive searched any source code or help over web. Ive found only about how to make COM+. I couldnt find how to create client calling the .net COM+ remotely.
Here is the code,
C#:
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:
C#:
//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());
}
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 couldnt find any help from any article including msdn..
Any comment will help!
Last edited by a moderator: