[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.remoting

Remoting without having server code/dll on the client

Micha_J

10/8/2004 1:37:00 PM

when i run the client without having the remote object, the busines logic dll
(HelloServer.dll) in the same directory i get an error message.
"File or assembly name Object not found"
If the HelloServer.dll is in the same directory everything works fine.
Does this mean I have to copy everytime the new server dll on the clients??
Is there a way to avoid this. I thought it would be possible to call a
remote object without having it on the clients
Thanks
Micha_J

all code is from the msdn remoting sample

server code

imports System
imports System.Runtime.Remoting
imports System.Runtime.Remoting.Channels
imports System.Runtime.Remoting.Channels.TCP

namespace RemotingSamples

public class Sample
shared sub main
dim chan as TCPChannel
chan = new TCPChannel(8085)
ChannelServices.RegisterChannel(chan)

RemotingConfiguration.RegisterWellKnownServiceType(Type.GetType("RemotingSamples.HelloServer, Object"), "SayHello", WellKnownObjectMode.SingleCall)
System.Console.WriteLine("Hit <enter> to exit...")
System.Console.ReadLine()
end sub
end class

end namespace

business logic

imports System
imports System.Runtime.Remoting
imports System.Runtime.Remoting.Channels
imports System.Runtime.Remoting.Channels.TCP

namespace RemotingSamples

public class HelloServer
inherits MarshalByRefObject

public sub HelloServer()
Console.WriteLine("HelloServer activated")
end sub

public function HelloMethod(name as String) as String
Console.WriteLine("Hello.HelloMethod : {0}", name)
Return String.Format("Hi there {0}", name)
end function

end class

end namespace


client

imports System
imports System.Runtime.Remoting
imports System.Runtime.Remoting.Channels
imports System.Runtime.Remoting.Channels.TCP

namespace RemotingSamples

public class Client

shared sub main
dim obj as HelloServer
Obj =
CType(Activator.GetObject(Type.GetType("RemotingSamples.HelloServer,
Object"), "tcp://localhost:8085/SayHello"), HelloServer)
if obj is nothing then
System.Console.WriteLine("Could not locate server")
else
Console.WriteLine(obj.HelloMethod("Caveman"))
end if
end sub

end class
end namespace


2 Answers

Ken Kolda

10/8/2004 7:52:00 PM

0

The solution is to use "interface-based" remoting. Read this:

http://www.genuinechannels.com/Content.aspx?id=28&...

Ken


"Micha_J" <Micha_J@discussions.microsoft.com> wrote in message
news:747E28AB-2C47-4CA0-B40A-E1FF09F8E0AB@microsoft.com...
> when i run the client without having the remote object, the busines logic
dll
> (HelloServer.dll) in the same directory i get an error message.
> "File or assembly name Object not found"
> If the HelloServer.dll is in the same directory everything works fine.
> Does this mean I have to copy everytime the new server dll on the
clients??
> Is there a way to avoid this. I thought it would be possible to call a
> remote object without having it on the clients
> Thanks
> Micha_J
>
> all code is from the msdn remoting sample
>
> server code
>
> imports System
> imports System.Runtime.Remoting
> imports System.Runtime.Remoting.Channels
> imports System.Runtime.Remoting.Channels.TCP
>
> namespace RemotingSamples
>
> public class Sample
> shared sub main
> dim chan as TCPChannel
> chan = new TCPChannel(8085)
> ChannelServices.RegisterChannel(chan)
>
>
RemotingConfiguration.RegisterWellKnownServiceType(Type.GetType("RemotingSam
ples.HelloServer, Object"), "SayHello", WellKnownObjectMode.SingleCall)
> System.Console.WriteLine("Hit <enter> to exit...")
> System.Console.ReadLine()
> end sub
> end class
>
> end namespace
>
> business logic
>
> imports System
> imports System.Runtime.Remoting
> imports System.Runtime.Remoting.Channels
> imports System.Runtime.Remoting.Channels.TCP
>
> namespace RemotingSamples
>
> public class HelloServer
> inherits MarshalByRefObject
>
> public sub HelloServer()
> Console.WriteLine("HelloServer activated")
> end sub
>
> public function HelloMethod(name as String) as String
> Console.WriteLine("Hello.HelloMethod : {0}", name)
> Return String.Format("Hi there {0}", name)
> end function
>
> end class
>
> end namespace
>
>
> client
>
> imports System
> imports System.Runtime.Remoting
> imports System.Runtime.Remoting.Channels
> imports System.Runtime.Remoting.Channels.TCP
>
> namespace RemotingSamples
>
> public class Client
>
> shared sub main
> dim obj as HelloServer
> Obj =
> CType(Activator.GetObject(Type.GetType("RemotingSamples.HelloServer,
> Object"), "tcp://localhost:8085/SayHello"), HelloServer)
> if obj is nothing then
> System.Console.WriteLine("Could not locate server")
> else
> Console.WriteLine(obj.HelloMethod("Caveman"))
> end if
> end sub
>
> end class
> end namespace
>
>


Micha_J

10/11/2004 7:45:00 AM

0

thanks, i will read this
Micha_J

"Ken Kolda" wrote:

> The solution is to use "interface-based" remoting. Read this:
>
> http://www.genuinechannels.com/Content.aspx?id=28&...
>
> Ken
>
>
> "Micha_J" <Micha_J@discussions.microsoft.com> wrote in message
> news:747E28AB-2C47-4CA0-B40A-E1FF09F8E0AB@microsoft.com...
> > when i run the client without having the remote object, the busines logic
> dll
> > (HelloServer.dll) in the same directory i get an error message.
> > "File or assembly name Object not found"
> > If the HelloServer.dll is in the same directory everything works fine.
> > Does this mean I have to copy everytime the new server dll on the
> clients??
> > Is there a way to avoid this. I thought it would be possible to call a
> > remote object without having it on the clients
> > Thanks
> > Micha_J
> >
> > all code is from the msdn remoting sample
> >
> > server code
> >
> > imports System
> > imports System.Runtime.Remoting
> > imports System.Runtime.Remoting.Channels
> > imports System.Runtime.Remoting.Channels.TCP
> >
> > namespace RemotingSamples
> >
> > public class Sample
> > shared sub main
> > dim chan as TCPChannel
> > chan = new TCPChannel(8085)
> > ChannelServices.RegisterChannel(chan)
> >
> >
> RemotingConfiguration.RegisterWellKnownServiceType(Type.GetType("RemotingSam
> ples.HelloServer, Object"), "SayHello", WellKnownObjectMode.SingleCall)
> > System.Console.WriteLine("Hit <enter> to exit...")
> > System.Console.ReadLine()
> > end sub
> > end class
> >
> > end namespace
> >
> > business logic
> >
> > imports System
> > imports System.Runtime.Remoting
> > imports System.Runtime.Remoting.Channels
> > imports System.Runtime.Remoting.Channels.TCP
> >
> > namespace RemotingSamples
> >
> > public class HelloServer
> > inherits MarshalByRefObject
> >
> > public sub HelloServer()
> > Console.WriteLine("HelloServer activated")
> > end sub
> >
> > public function HelloMethod(name as String) as String
> > Console.WriteLine("Hello.HelloMethod : {0}", name)
> > Return String.Format("Hi there {0}", name)
> > end function
> >
> > end class
> >
> > end namespace
> >
> >
> > client
> >
> > imports System
> > imports System.Runtime.Remoting
> > imports System.Runtime.Remoting.Channels
> > imports System.Runtime.Remoting.Channels.TCP
> >
> > namespace RemotingSamples
> >
> > public class Client
> >
> > shared sub main
> > dim obj as HelloServer
> > Obj =
> > CType(Activator.GetObject(Type.GetType("RemotingSamples.HelloServer,
> > Object"), "tcp://localhost:8085/SayHello"), HelloServer)
> > if obj is nothing then
> > System.Console.WriteLine("Could not locate server")
> > else
> > Console.WriteLine(obj.HelloMethod("Caveman"))
> > end if
> > end sub
> >
> > end class
> > end namespace
> >
> >
>
>
>