Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. .NET remoting and calling a Constructor with parameters

.NET remoting and calling a Constructor with parameters

Scheduled Pinned Locked Moved .NET (Core and Framework)
csharpsysadminhelptutorialquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Ponzano Paolo
    wrote on last edited by
    #1

    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

    P 1 Reply Last reply
    0
    • P Ponzano 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 Paolo

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      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.

      My blog | My articles

      P 1 Reply Last reply
      0
      • P Pete OHanlon

        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.

        My blog | My articles

        P Offline
        P Offline
        Ponzano Paolo
        wrote on last edited by
        #3

        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

        P 1 Reply Last reply
        0
        • P Ponzano Paolo

          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

          P Offline
          P Offline
          Pete OHanlon
          wrote on last edited by
          #4

          Ponzano 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.

          My blog | My articles

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups