Hello,
I am new to this list. I am getting an exception when I'm running a method
with enumerated parameters in COM+. I can't figure it out for the life of
me, and any assistance you can provide would be greatly appreciated.
I created a .NET class in C# that interops with COM and is also installed as
a COM+ SERVER package. The problem is when I have an enumerated type as a
parameter in a method of my class. Both the .NET class and client compile.
And I can instantiate the object no problem, but as soon as I run a method
with an enumerated type as a parameter I get the following exception:
------------
File or assembly name MyComPlusServer, or one of its dependencies, was not
found.
at
System.EnterpriseServices.IRemoteDispatch.RemoteDispatchNotAutoDone(String
s)
at System.EnterpriseServices.RemoteServicedComponentProxy.Invoke(IMessage
reqMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
msgData, Int32 type)
at MyComPlusServer.MyComPlusServerClass.DoSomething(CarTypes eMyCar) in
d:\visual studio projects\mycomplusserver\class1.cs:line 28
at MyComPlusClient.Form1.button1_Click(Object sender, EventArgs e) in
d:\visual studio projects\mycomplusclient\form1.cs:line 106
------------
Everything compiles fine, and I can install the server into COM+ (using
regsvcs) no problem. This works wonderfully from a VB6 client. It also works
when the .NET class is installed as a COM+ library application, instead of a
server application.
Thanks again,
-Kuthair
Here is some sample code:
=========================================
My .NET server class
=========================================
[assembly: AssemblyKeyFile("mysnk.snk")]
[assembly: ApplicationActivation(ActivationOption.Server)]
[assembly: ApplicationID("E6F3F75B-9957-4bc9-BA00-ACAD8D7941A6")]
[assembly: ApplicationName("MyComPlusServer")]
[assembly: Description("Doesn't do much")]
using System;
using System.Runtime.InteropServices;
using System.EnterpriseServices;
namespace MyComPlusServer
{
[Guid("E04A86A4-883E-4f7d-B4FA-A6A1061DFD72")]
// Support both early and late-bound calls from an unmanaged client
[ClassInterface(ClassInterfaceType.AutoDual)]
// Enable ObjectPooling with these defaults
[ObjectPooling(true, 4, 12, CreationTimeout = 20000)]
// Enable JIT activation
[JustInTimeActivation(true)]
// Enable statistics
[EventTrackingEnabled(true)]
public class MyComPlusServerClass : ServicedComponent
{
public enum CarTypes : byte { Ford = 0, Chevy = 22, Chrysler = 5, VW
= 99}
public MyComPlusServerClass()
{
}
public int DoSomething(CarTypes eMyCar)
{
// do somework
return 100;
}
}
}
=========================================
My .NET client
=========================================
private void button1_Click(object sender, System.EventArgs e)
{
try
{
MyComPlusServer.MyComPlusServerClass objServerClass = new
MyComPlusServer.MyComPlusServerClass();
objServerClass.DoSomething(MyComPlusServer.MyComPlusServerClass.CarTypes.VW);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message + System.Environment.NewLine +
ex.StackTrace);
}
}
=========================================
_________________________________________________________________
Choose an Internet access plan right for you -- try MSN!
http://resourcecenter.msn.com/access/plans/default.asp
You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.