The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

import-bot (20211) [Avatar] Offline
#1
[Originally posted by hwayoungko]

using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Http;

namespace RemoteEncoder
{

class Base64Client
{

public static void Main(string[] args)
{

ChannelServices.RegisterChannel(new HttpChannel());

IStringEncoder
objRef=(IStringEncoder)Activator.GetObject(typeof(IStringEncoder),
"http://localhost/RemoteEncoder/Base64Service.rem");

string s1="Mary had a little lamb.";
if(args.Length > 0) s1 = args[0];

Console.WriteLine("original : {0}", s1);

string s2=objRef.Encode(s1); // <- here error has been causing.

// I made bin directory following book.
/*
*
C:InetpubwwwrootRemoteEncoder>base64client
original : Mary had a little lamb.

Exception : System.Runtime.Remoting.RemotingException: clr:RemoteEncoder
.IStringEncoder, istringencoder -- Can't load this type.

Server stack trace:
at System.Runtime.Remoting.Messaging.MethodCall.ResolveMethod(Boolean bThrowI
fNotResolved)
at System.Runtime.Remoting.Messaging.MethodCall.HeaderHandler(Header[] h)
at System.Runtime.Serialization.Formatters.Soap.ObjectReader.ParseObject(Pars
eRecord pr)
at System.Runtime.Serialization.Formatters.Soap.ObjectReader.Parse(ParseRecor
d pr)
at System.Runtime.Serialization.Formatters.Soap.SoapHandler.StartChildren()
at System.Runtime.Serialization.Formatters.Soap.SoapParser.ParseXml()
at System.Runtime.Serialization.Formatters.Soap.SoapParser.Run()
at System.Runtime.Serialization.Formatters.Soap.ObjectReader.Deserialize(Head
erHandler handler, ISerParser serParser)
at System.Runtime.Serialization.Formatters.Soap.SoapFormatter.Deserialize(Str
eam serializationStream, HeaderHandler handler)
at System.Runtime.Remoting.Channels.SoapServerFormatterSink.ProcessMessage(IS
erverChannelSinkStack sinkStack, IMessage requestMsg, ITransportHeaders requestH
eaders, Stream requestStream, IMessage& responseMsg, ITransportHeaders& response
Headers, Stream& responseStream)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage req
Msg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgDa
ta, Int32 type)
at RemoteEncoder.IStringEncoder.Encode(String s)
at RemoteEncoder.Base64Client.Main(String[] args)


here is my error message. it seems that my IIS has some problem.
some example which I last examined was working well. those were using
.config file in the current directory. But this one is a bit different.
I should make bin subdirectory. Why only my machine not working? it never
find bin subdirectly so that it wouldn't refer to istringencoder.dll.
Please help me.


*/

Console.WriteLine("encoded : {0}", s2);
Console.WriteLine("decoded : {0}", objRef.Decode(s2));
}
}
}


__
import-bot (20211) [Avatar] Offline
#2
Re: ch 5. remoting
[Originally posted by fgrimes]

>> those were using .config file in the current
>> directory. But this one is a bit different. I
>> should make bin subdirectory.

Place web.config file (listing 5.16) in app root directory, not bin
subdirectory.

Fergal