Toon posts:

[.NET C#] remoting probleem

Pagina: 1
Acties:

Verwijderd

Topicstarter
Ik krijg een vreemde fout in een .net remoting app.

Als is de volgende code uitvoer :
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
public RemoteFoonZoekDataSource(string url)
{
                try
    {
                    TcpChannel chan  = new TcpChannel();
        ChannelServices.RegisterChannel(chan);
        this.service = (FoonZoekRemoteService)Activator.GetObject(typeof(FoonZoek.Service.FoonZoekRemoteService),url);
    }
    catch (Exception e)
    {
        Console.WriteLine("[e] An exception occurred.");
        Console.WriteLine(e);
        throw e;
    }
}


Ik krijg de volgende foutmelding :
Cannot create channel sink to connect to URL 192.168.1.2. An appropriate channel has probably not been registered.

Terwijl de server gewoon draait op de machine met 192.168.1.2.

Als ik het op de volgende systemen draai :
server : windows 2000 professional
client : windows 98
gaat alles goed.

Draai ik het op:
server : windows 2003 standaard edition
client : windows 2000 professional
krijg ik de fout.

En als ik de client en de server op 2003 draai gaat het ook fout.

Server code
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
static void Main(string[] args)
        {
            Console.WriteLine("FoonZoek server");
            Console.WriteLine("\n[i] Starting Server...");
            try {
                // Create our TCP communication channel, which will sit in
                // our local TCP/IP stack on port 8085.
                Console.WriteLine("[i] -- Creating TCP channel");
                TcpChannel chan = new TcpChannel(8085);

                Console.WriteLine("[i] -- Registering TCP channel");
                ChannelServices.RegisterChannel(chan);
                
                Console.WriteLine("[i] -- Registering the Searcher object");
                RemotingConfiguration.RegisterWellKnownServiceType(typeof(FoonZoek.Service.FoonZoekRemoteService),"FoonZoekService", WellKnownObjectMode.Singleton);

                Console.WriteLine("[i] Server started, press <enter> to exit...");
                Console.ReadLine();
             } catch (Exception e) {
                 Console.WriteLine("[!] An error occured while initialising the FoonZoekEngine.");
                 // Dump the Exception stack trace to the console.
                 Console.WriteLine(e);
             }
        }


De poort waarop de service op de server gestart wordt is 8085.

  • whoami
  • Registratie: December 2000
  • Laatst online: 23:52
Hoe ziet de URL er uit waarmee je je object creeërt.
Maw, wat is de url die je doorgeeft aan de Activator.GetObject method.

https://fgheysels.github.io/


  • whoami
  • Registratie: December 2000
  • Laatst online: 23:52
Of probeer anders ook eens a/d client kant 0 door te geven aan de constructor van het channel:

code:
1
TcpChannel chan = new TcpChannel(0);


Hiermee gaat ie automatisch de juiste poort zoeken.

https://fgheysels.github.io/


Verwijderd

Topicstarter
whoami schreef op 12 juli 2004 @ 22:13:
Hoe ziet de URL er uit waarmee je je object creeërt.
Maw, wat is de url die je doorgeeft aan de Activator.GetObject method.
Dat was idd de fout, had verkeerde url in het config bestand gezet.