Hello,
I have a server that publish remoting objects.
When I try to use these objects with my client, all is ok.
But now, I want to use one method of these object via COM.
So, I create a "wrapper".
But, with COM, I receive an error : "return argument has an invalid type"
My (simplified) code is at the end of this mail.
My server publish an object.
This object has a testmethod and an indexer that return another object. And
this other object has a test method.
Via COM, I receive the result of the first test method, but error with the
second object
Do you have any idea ?
Thx
// INTERFACE
namespace Dufour.InterfaceBascule
{
public interface IRemoteBascules
{
Dufour.InterfaceBascule.IRemoteBascule this[int index]
{
get;
}
int GetNbreBascule();
}
public interface IRemoteBascule
{
int Test();
}
}
// Objects
namespace Dufour.Bascules
{
[Serializable]
public class Bascules : MarshalByRefObject,
Dufour.InterfaceBascule.IRemoteBascules
{
private static Bascule[] m_bascules = new Bascule[5];
private int NbreBascule=5;
public Dufour.InterfaceBascule.IRemoteBascule this[int index]
{
get
{
if (m_bascules[index] == null)
{
m_bascules[index] = new Bascule(4);
}
return m_bascules[index];
}
}
public int GetNbreBascule()
{
return NbreBascule;
}
}
[Serializable]
public class Bascule :
MarshalByRefObject,Dufour.InterfaceBascule.IRemote Bascule
{
public int Test()
{
return 110;
}
}
}
//The SERVER . net remoting
....
TcpChannel channel = new TcpChannel(7000);
ChannelServices.RegisterChannel(channel,false);
RemotingConfiguration.RegisterWellKnownServiceType (typeof(Bascules),
"RemoteBascules", WellKnownObjectMode.Singleton);
.....
// The com object
namespace Dufour.Bascule
{
[InterfaceType(ComInterfaceType.InterfaceIsIDispatc h)]
public interface IAutomationBascules
{
int GetWeight(int Bascule);
}
[ClassInterface(ClassInterfaceType.None)]
public class AutomationBascules : IAutomationBascules
{
public int GetWeight(int Bascule)
{
Dufour.InterfaceBascule.IRemoteBascules b;
try
{
TcpChannel channel = new TcpChannel();
ChannelServices.RegisterChannel(channel, false);
b =
(Dufour.InterfaceBascule.IRemoteBascules)Activator .GetObject(typeof(Dufour.I
nterfaceBascule.IRemoteBascules), "tcp://localhost:7000/RemoteBascules");
return(b[1].Test()); // return b.GetNbreBascule is OK
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
return 0;
}
}
}
} 0 802 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Sean Newton |
last post by:
I am absolutely bewildered by now by the Microsoft.Samples SSPI and Security
assemblies. I've been trying to set these up in a very straightforward
harness in the way that I'd like to be able to...
|
by: bettervssremoting |
last post by:
To view the full article, please visit
http://www.BetterVssRemoting.com
Better VSS Remote Access Tool
This article makes a detailed comparison among SourceAnyWhere,
SourceOffSite, VSS...
|
by: mayamorning123 |
last post by:
A comparison among six VSS remote tools including SourceOffSite ,
SourceAnyWhere, VSS Connect, SourceXT, VSS Remoting, VSS.NET
To view the full article, please visit...
|
by: bettervssremoting |
last post by:
To view the full article, please visit
http://www.BetterVssRemoting.com
Better VSS Remote Access Tool including SourceOffSite, SourceAnyWhere
and VSS Remoting
This article makes a detailed...
|
by: Uchiha Jax |
last post by:
Hello everyone,
I am a plenty silly person who is trying to
learn .NET remoting through trial and error (all articles I read are going
over my head at the moment (mostly) so I thought i'd give...
|
by: bettervssremoting |
last post by:
To view the full article, please visit
http://www.BetterVssRemoting.com
Better VSS Remote Access Tool
This article makes a detailed comparison among SourceAnyWhere,
SourceOffSite, VSS...
|
by: Martijn Damen |
last post by:
Hi,
At the moment I am trying to develop an application that uses another app
over .net remoting and having some problems with it (ok, that is ofcourse
why I am here), hope somebody can shine a...
|
by: Raju Joseph |
last post by:
Hi All,
I am just trying to get an opinion here. I know this is always a tough
choice to make.
We are in the process of converting our VB6 based Healthcare Information
System (a full-fledged...
|
by: erbilkonuk |
last post by:
Hi,
I am very new to .NET Remoting and I try to run a simple program to
subscribe to an event raised by Remoting Class. The Remoting Server
initiates an instance of Remoting Class as Singleton /...
|
by: Kristian Reukauff |
last post by:
Hi
I have a problem with the .Net-Securty-Functions.
I've got a client and a server.
When I try to register a channel at the server with this line:
ChannelServices.RegisterChannel(chan, false);...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |