.NET remoting and calling a Constructor with parameters
-
Hello to everybody, I need to use .NET remoting to create a remote object with a 3parameter constructor, I'm not able to find an example, can anyone provide me a working example? I've also tried to call a parameterless constructor then using the properties but I got the error below:
myDBHelper = (DBHelper) Activator.CreateInstance(typeof (DBHelper)); myDBHelper.IdCup = 1; <- //The server committed a protocol violation. Section=ResponseStatusLine int i = 0;
Thanks Paolo -
Hello to everybody, I need to use .NET remoting to create a remote object with a 3parameter constructor, I'm not able to find an example, can anyone provide me a working example? I've also tried to call a parameterless constructor then using the properties but I got the error below:
myDBHelper = (DBHelper) Activator.CreateInstance(typeof (DBHelper)); myDBHelper.IdCup = 1; <- //The server committed a protocol violation. Section=ResponseStatusLine int i = 0;
Thanks PaoloYou could always do this like this:
myDBHelper = (DBHelper) Activator.CreateInstance(typeof (DBHelper), new object[]{"Param1", 1, "Item"});
Deja View - the feeling that you've seen this post before.
-
You could always do this like this:
myDBHelper = (DBHelper) Activator.CreateInstance(typeof (DBHelper), new object[]{"Param1", 1, "Item"});
Deja View - the feeling that you've seen this post before.
hello Pete, I've tried with this :
myDBHelper = (DBHelper)Activator.CreateInstance(typeof(DBHelper), new object[] { idCup, idSeason, idMatchCode });
but I get this error : {"Cannot run a non-default constructor when connecting to well-known objects."} Getting bored.... with CAO object I'm able but I got the memory used by the server increase a lot and won't free in any way... Thank -
hello Pete, I've tried with this :
myDBHelper = (DBHelper)Activator.CreateInstance(typeof(DBHelper), new object[] { idCup, idSeason, idMatchCode });
but I get this error : {"Cannot run a non-default constructor when connecting to well-known objects."} Getting bored.... with CAO object I'm able but I got the memory used by the server increase a lot and won't free in any way... ThankPonzano Paolo wrote:
I've tried with this : myDBHelper = (DBHelper)Activator.CreateInstance(typeof(DBHelper), new object[] { idCup, idSeason, idMatchCode }); but I get this error : {"Cannot run a non-default constructor when connecting to well-known objects."} Getting bored.... with CAO object I'm able but I got the memory used by the server increase a lot and won't free in any way...
You're using a Server Activated Object which means that you can't use nondefault constructors. When you think about it, this makes perfect sense because the instantiation of the proxy and the actual object occur at different times. Either you have to use CAO, or you have to change your remote object to use a separate mechanism, such as a remote method, to populate these values.
Deja View - the feeling that you've seen this post before.