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. C#
  4. .Net remoting, registering two channel? how???

.Net remoting, registering two channel? how???

Scheduled Pinned Locked Moved C#
csharphelpquestionworkspace
2 Posts 1 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, I've got an application that needs to create 2 remote object (CAO type), I init them into businness logic level: private void InitNetRemotingProxy() { myDataProxyAccess = new ProxyDataAccess(idCup, idSeason, idMatchCode); myDataProxyAccess.InitNetRemotingClient("Normal"); myDataProxyAccessForLev1 = new ProxyDataAccess(idCup, idSeason, idMatchCode); myDataProxyAccess.InitNetRemotingClient("Lev1"); } and here's where the init is done public void InitNetRemotingClient(string type) { string remotingConnection = system.Configuration.ConfigurationManager.AppSettings["serverAddress"]; string tcpPort = (type!="Lev1") ? System.Configuration.ConfigurationManager.AppSettings["tcpPort"] : System.Configuration.ConfigurationManager.AppSettings["tcpPortLev1Stat"]; string requestService = (type != "Lev1") ? System.Configuration.ConfigurationManager.AppSettings["requestServiceName"] : System.Configuration.ConfigurationManager.AppSettings["requestServiceName2"]; string sb = String.Format("tcp://{0}:{1}/{2}", remotingConnection, tcpPort, requestService); try { RemotingConfiguration.IsRemotelyActivatedClientType(typeof(DBHelper)); IChannel ic = new TcpChannel(Convert.ToInt32(tcpPort)); int i = 0; ChannelServices.RegisterChannel(ic, false); RemotingConfiguration.RegisterActivatedClientType(typeof(DBHelper), sb); myDBHelper = new DBHelper(idCup, idSeason, idMatchCode); } on the second call, the one myDataProxyAccess.InitNetRemotingClient("Lev1"); I get an exception at ChannelServices.RegisterChannel(ic, false);, the exception is : Message = "The channel 'tcp' is already registered.". It's not possible to create 2 channel? Where I do wrong? The tcpport and requestServiceName are different for the two calls. Please help me, thanks Bests Paolo Ponzano

    P 1 Reply Last reply
    0
    • P Ponzano Paolo

      Hello, I've got an application that needs to create 2 remote object (CAO type), I init them into businness logic level: private void InitNetRemotingProxy() { myDataProxyAccess = new ProxyDataAccess(idCup, idSeason, idMatchCode); myDataProxyAccess.InitNetRemotingClient("Normal"); myDataProxyAccessForLev1 = new ProxyDataAccess(idCup, idSeason, idMatchCode); myDataProxyAccess.InitNetRemotingClient("Lev1"); } and here's where the init is done public void InitNetRemotingClient(string type) { string remotingConnection = system.Configuration.ConfigurationManager.AppSettings["serverAddress"]; string tcpPort = (type!="Lev1") ? System.Configuration.ConfigurationManager.AppSettings["tcpPort"] : System.Configuration.ConfigurationManager.AppSettings["tcpPortLev1Stat"]; string requestService = (type != "Lev1") ? System.Configuration.ConfigurationManager.AppSettings["requestServiceName"] : System.Configuration.ConfigurationManager.AppSettings["requestServiceName2"]; string sb = String.Format("tcp://{0}:{1}/{2}", remotingConnection, tcpPort, requestService); try { RemotingConfiguration.IsRemotelyActivatedClientType(typeof(DBHelper)); IChannel ic = new TcpChannel(Convert.ToInt32(tcpPort)); int i = 0; ChannelServices.RegisterChannel(ic, false); RemotingConfiguration.RegisterActivatedClientType(typeof(DBHelper), sb); myDBHelper = new DBHelper(idCup, idSeason, idMatchCode); } on the second call, the one myDataProxyAccess.InitNetRemotingClient("Lev1"); I get an exception at ChannelServices.RegisterChannel(ic, false);, the exception is : Message = "The channel 'tcp' is already registered.". It's not possible to create 2 channel? Where I do wrong? The tcpport and requestServiceName are different for the two calls. Please help me, thanks Bests Paolo Ponzano

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

      I've fixed it, I've used: IDictionary pros = new Hashtable(); pros["port"] = tcpPort; pros["name"] = type; IChannel ic = new TcpChannel(pros, null, null); and I had to substitute RemotingConfiguration.RegisterActivatedClientType(typeof(DBHelper), sb); with RemotingServices.Connect(typeof (DBHelper), sb); Seems to work, do you know if there's still something I've to do? Thanks

      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