MSDN .Net Remoting Sample ?

  • Thread starter Thread starter swartzbill2000
  • Start date Start date
S

swartzbill2000

Hello,
I am trying to build and run the Remoting Sample from MSDN. Everything
compiles. The Listener appears to run. The Client throws this
RemotingException:

A first chance exception of type
'System.Runtime.Remoting.RemotingException' occurred in mscorlib.dll
RemotingException.Message
Cannot load type 'RemotableType, RemotableType'.
RemotingException.StackTrace

Server stack trace:
at
System.Runtime.Remoting.RemotingConfigHandler.RemotingConfigInfo.LoadType(String
typeName, String assemblyName)
at
System.Runtime.Remoting.RemotingConfigHandler.RemotingConfigInfo.GetServerTypeForUri(String
URI)
at
System.Runtime.Remoting.RemotingConfigHandler.GetServerTypeForUri(String
URI)
at
System.Runtime.Remoting.RemotingServices.GetServerTypeForUri(String
URI)
at
System.Runtime.Remoting.Channels.SoapServerFormatterSink.ProcessMessage(IServerChannelSinkStack
sinkStack, IMessage requestMsg, ITransportHeaders requestHeaders,
Stream requestStream, IMessage& responseMsg, ITransportHeaders&
responseHeaders, Stream& responseStream)

Exception rethrown at [0]:
at
System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
reqMsg, IMessage retMsg)
at
System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
msgData, Int32 type)
at RemotableType.RemotableType.StringMethod()
at Client.Client.Form1_Load(Object sender, EventArgs e) in
C:\Documents and Settings\Owner\My Documents\Visual Studio
2005\Projects\RhsRemotingTest\Client\Client\Client.vb:line 13

Any ideas?
Bill
 
My suggestion is not to use remoting.

I have done some work with it ... I would look into Indigo, Windows
Communication Foundation instead.
 
You may have a point. With my current problem,
'Activator.CreateInstance' returns its System.Object without throwing
an exception. 'CType' casts the System.Object to the particular type
without throwing an exception either. When I try to use the instance of
the particular type, everything hangs. Has anyone seen this before?
Bill
 
Nonsense. Remoting is extraordinarily easy. It's insane how easy it is.

Without seeing your code there's no way to tell what you're doing wrong. Is
your remote class inheriting MarshalByRefObject, did you create a simple Exe
host or are you using IIS... lots of questions. Is the remote on a different
machine, is it firewalled?

I'd forget using a "sample" and create your own starting point by hand.
You'll learn a lot more.
http://www.thinktecture.com/Resources/RemotingFAQ/default.html
 
Absolutely agree with CMM. Remoting has some different concepts that a
beginner or even intermediate program might struggle with, but it is a
extremly good solution if you have to pass objects across different app
domains.

Also post your client code.
 
Hello,
I am trying to build and run the Remoting Sample from MSDN. Everything
compiles. The Listener appears to run. The Client throws this
RemotingException:

Actually, the client is implicitly catching the exception and rethrowing it
:-)

(Haven't seen the example, but)
Are you using your own process to host the Remote Component, or IIS.

Is your remote Component added to the Global Assembly Cache or in
the same [application] directory as your host process?

Are you doing any of the remoting "work" yourself or just using

RemotingConfiguration.Configure()

and letting the Framework do it all for you?

Regards,
Phill W.
 
I am using my own process.
The remote component is not in the GAC.
I got rid of 'RemotingConfiguration.Configure()' and am getting
further.
I am starting over and making my own (component,server,client) sample.
I will repost new problems.
Bill
 
I now have a working simple (RemotableType,Listener,Client) sample. The
RemotableType resides in a DLL. Both the Listener and Client have
references to the DLL. I want to remove the Client dependency on the
DLL by using an interface I call IRemotable. RemotableType now
Implements the interface. I added IRemotable.vb to the Client. Now
'Activator.GetObject' appears to succeed, as does 'DirectCast' to cast
the Object to IRemotable. The first method call fails with this info:
RemotingException.Message
Cannot load type 'Client.IRemotable, Client, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null'.

How can I fix it?
Bill
 
So, I am have the same problem... what sucks for me is that you did not post
your solution to the original problem. Could you post your working code. Once
I have remoting working properly I will need to implement an interface as you
described. But first things first, how did you solve your "Cannot load type"
problem?
 
Back
Top