I've got a problem with remoting that I don't understand...
Could you explain me what happend with this code?? When I unregister the channel and try to get the object again, the code throws an exception...
If you unregistered channel, Client doesn't have means "to talk" to Server.
It's the same if would you tried to get reference to object without registering any channel.
You have to register channel again before the call of Activator.GetObject.
"...hasn't really been well accepted ... as the ratings tell us so far " - Nishant S
There is no tool to help to do this using .NET, at least currently : we have tlbimp.exe, tlbexp.exe, aximp.exe. And guess what, we don't have axexp.exe.
Basically you need to export an object which exposes the common interfaces exposed by an ActiveX object, which are IOleObject, IOleControl, IDispatch just to name the few mandatory ones.
Exposing interfaces is not hard, tlbexp.exe does all the work.
But you have to create an object, which inherits those interfaces. At this point, if I was asked to do just that, I would try to derive the axhost class (winforms namespace), which is the base class used when it comes to instantiating ActiveX objects.
May be you are even better off writing everything from scratch.
To know what interfaces to implement, and to see the wonderful thing appear in the Control Test Container, I would recommend an old Fritz Onion article[^].
However, the window is created with the WS_CHILD style, which makes it be "inside" the main window. This I do not want. How can I make it not use the WS_CHILD style, but still have the main window as its parent? I don't see any place to specify the window styles manually...
I'm experiencing a problem with DataSets. If I use a DataSet as a parameter of a method in a Serviced Component, I always receive an InvalidCastException because something is trying to convert __ComObject to DataSet. When a method only returns a DataSet (no DataSet as parameter) there's no problem.
I'm running my application with framework 1.1, the serviced component is in Server mode.
Is this some bug in the .Net framework? Has anyone a solution or a workaround for this problem?
I ran into this problem working with C# based queued components.
Datasets are serializable, they support ISerializable however alot of things with COM+ (especially with Queued Components) is that they need the components to support IPersist.
They have no idea how to serialize using the ISerializable interface therefore you either go the route of dataset--> XML, XML--> dataset or implement IPersist within your component.
Well its relatively fast and uses a buffered stream. I mean really when your marshalling your Dataset you serialize the object to text then back again. And its basically the same thing. WriteXML is the fastest firehose method of the class. But yeah it would be better to do a dataset. You might try createing an object, clone the dataset to that object then marshalling it over the boundary. That might work. Or use the serializable attribute above a custom class that inherits the dataset.
Personally, With DataSets I use reflection to populate classes then update them with COM+ life cycles. Much more elegant and easier to load balance. That and business rules on forms and behind the scenes are simple to implement.
I'm not an expert yet, but I play one at work. Yeah and here too.