Click to See Complete Forum and Search --> : need help with config file
ppl1
July 25th, 2005, 10:36 AM
i have a remote object in the server side which implements an interface that declared in a dll.
something like that:
DLL-
interface Iremote{..}
Server Side-
class RemoteClass implements Iremote{..}
Client Side-
//connect to server
//Activator.GetObject --> typeof Iremote!!
till now everything is ok
now im trying to put it in a configuration file:
<service>
<wellknown mode="Singleton"
type="ServerSide.RemoteClass ,ServerSide" />
</service>
but what should i write in the "type"??
i know ServerSide.RemoteClass is wrong,
the type supposed to be - new RemoteClass().GetType()
but how to write that in the config?
thanks in advanced
MarioGiacomino
July 25th, 2005, 12:36 PM
I assume that the config file is on the client side. So since ServerSide.RemoteClass implements the interface IRemote you can simply write:
<service>
<wellknown mode="Singleton"
type="<IRemoteNamespace>.IRemote, <IRemoteNamespace>" />
</service>
Where <IRemoteNamespace> is the namespace of the IRemote interface.
Hope this works for you.
Mario
ppl1
July 26th, 2005, 02:35 AM
actually the config file is on the server side
so i tried that-
<service>
<wellknown mode="Singleton" type="IRemoteNamespace.IRemote,IRemoteNamespace" objectUri="Server.rem"/>
</service>
but its not working.
what else can it be?
thanks
ppl1
July 28th, 2005, 02:21 AM
plz..plz..plz..
anyone?
Norfy
July 28th, 2005, 02:32 AM
Don't know any specifics but the following links may give you more background information
.NET Remoting FAQ (http://www.thinktecture.com/Resources/RemotingFAQ/default.html)
(Maybe) in particular: HOWTO: Use Interface-based remote objects with config files (http://www.thinktecture.com/Resources/RemotingFAQ/USEINTERFACESWITHCONFIGFILES.html)
ppl1
July 28th, 2005, 03:18 AM
thanks but id didnt found there what i need...
any more ideas?
Norfy
July 28th, 2005, 04:53 AM
I for one find it diificult to debug code I cannot see...
Any chance you can post the client, server and shared library code, as well as the client and server config files?
ppl1
July 28th, 2005, 11:08 AM
ok, here is the code-
//class library
public interface IRemoteObject
{
Guid register();
}
//client side(inside main)
TcpChannel chan=new TcpChannel();
ChannelServices.RegisterChannel(chan);
IRemoteObject obj=(Library.IRemoteObject)Activator.GetObject(typeof(Library.IRemoteObject),"tcp://localhost:8085/Server");
Guid id=obj.register();
//server side(inside main)
RemotingConfiguration.Configure("ServerSide.exe.config");
//server side (config)
<system.runtime.remoting>
<application>
<channels>
<channel name="channel1" ref="tcp" port="8085"></channel>
</channels>
<service>
<wellknown mode="Singleton" type="ServerSide.TasksManagement,ServerSide" objectUri="ServerSide.rem"/>
</service>
</application>
</system.runtime.remoting>
//server side(remote object)
public class TasksManagement: MarshalByRefObject,IRemoteObject
{
public Guid register()
{ return System.Guid.NewGuid();
}
}
Norfy
July 29th, 2005, 01:26 AM
Quick guess: Shouldn't "tcp://localhost:8085/Server" match your server config ie. "tcp//localhost:8055/ServerSide.rem" ?
ppl1
July 29th, 2005, 02:01 AM
ok so i changed it in the server side to-
IRemoteObject obj=(Library.IRemoteObject)Activator.GetObject(typeof(Library.IRemoteObject),"tcp://localhost:8085/ServerSide/TasksManagement.rem");
and in he config on the server side i wrote-
<wellknown mode="Singleton" type="ServerSide.TasksManagement,ServerSide" objectUri="TasksManagement.rem"/>
but it still not working...
Norfy
July 29th, 2005, 02:25 AM
This is still wrong:
"tcp://localhost:8085/ServerSide/TasksManagement.rem"
Should be:
"tcp://localhost:8085/TasksManagement.rem"
This may still not work but it definitely won't work with such obvious mistakes.
Norfy
July 29th, 2005, 03:05 AM
PS. I assume your server code actually isRemotingConfiguration.Configure("ServerSide.exe.config");
Console.ReadLine();
ppl1
July 29th, 2005, 03:10 AM
yes
Norfy
July 29th, 2005, 03:18 AM
Working now then?
ppl1
July 29th, 2005, 03:21 AM
still not working
Norfy
July 29th, 2005, 03:33 AM
I took your code and it works fine!!!
Attached are the files I used in three separate assemblies; ServerSide, Library and Client respectively.
Below is the ServerSide config.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.runtime.remoting>
<application>
<channels>
<channel name="channel1" ref="tcp" port="8085"></channel>
</channels>
<service>
<wellknown mode="Singleton" type="ServerSide.TasksManagement, ServerSide" objectUri="TaskManagement.rem" />
</service>
</application>
</system.runtime.remoting>
</configuration>
ppl1
July 29th, 2005, 04:39 AM
well..after i created a new project and deal with RegServer it worked!!
so thanks a lot for the help :)
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.