I am struggeling to get the Microsoft.Samples.Runtime.Remoting.Security
sample to work using programming Sinkprovider creation rather than the
config file. I register the channel and all is well.
The first call goes through to my SAO but when I try and make a second call
I get follwoing Exception and Stack Trace.
----------------------------------------------------------------------------
------------------------------------------------
Exception Message : Value cannot be null.
Parameter name: InStringException
----------------------------------------------------------------------------
------------------------------------------------
Server stack trace:
at System.Convert.FromBase64String(String s)
at
Global.Remoting.Security.ChannelSinkCallContext.DeserializeStringToChannelSi
nkCallContext(String serializedGraph) in D:\My Documents\Dev Stuff\Visual
Studio Projects\C# Projects\Global
Stuff\Global\Global.Remoting\Security\ChannelSinkCallContext.cs:line 264
at
Global.Remoting.Security.SecurityChannelSinkBase.SendMessageToServerSink(Cli
entContext clientContext, IClientChannelSink nextSink,
ChannelSinkCallContext channelSinkCallContext, IMessage msg,
ITransportHeaders requestHeaders, Stream requestStream, ITransportHeaders&
responseHeaders, Stream& responseStream) in D:\My Documents\Dev Stuff\Visual
Studio Projects\C# Projects\Global
Stuff\Global\Global.Remoting\Security\BaseObjects\SecurityChannelSinkBase.cs
:line 228
at
Global.Remoting.Security.SecurityClientChannelSink.ProcessMessage(IMessage
msg, ITransportHeaders requestHeaders, Stream requestStream,
ITransportHeaders& responseHeaders, Stream& responseStream) in D:\My
Documents\Dev Stuff\Visual Studio Projects\C# Projects\Global
Stuff\Global\Global.Remoting\Security\SecurityClientChannelSink.cs:line 132
at
System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMessag
e(IMessage msg)
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 Global.Data.Interface.IClassLoader.HelloWorld(String message)
at RemotingTest.Client.Client.Main(String[] args) in d:\my documents\dev
stuff\visual studio projects\c# projects\global stuff\global
test\clienttest\client\client.cs:line 37
----------------------------------------------------------------------------
------------------------------------------------
Here is my code when I create the ChannelSinkProvider:
public static IServerChannelSinkProvider ServerChannelSinkProvider
{
get
{
IServerChannelSinkProvider returnObject = new
BinaryServerFormatterSinkProvider();
returnObject.Next = new
SecurityServerChannelSinkProvider(RemotingHelper.SecurityDictionaryBuilder()
, null);
return returnObject;
}
}
public static IClientChannelSinkProvider ClientChannelSinkProvider
{
get
{
IClientChannelSinkProvider returnObject = new
BinaryClientFormatterSinkProvider();
returnObject.Next = new
SecurityClientChannelSinkProvider(RemotingHelper.SecurityDictionaryBuilder()
, null);
return returnObject;
}
}
public static IDictionary SecurityDictionaryBuilder()
{
Hashtable properties = new Hashtable();
properties["securityPackage"] = "negotiate"; // "negotiate", "kerberos",
"ntlm"
properties["authenticationLevel"] = "call"; // "call", "packetIntegrity",
"packetPrivacy"
properties["impersonationLevel"] = "identify"; // "identify",
"impersonate", "delegate"
properties["authenticationHandler"] = null; //"myAuthenticationHandler"; //
the event handler
return properties;
}
----------------------------------------------------------------------------
------------------------------------------------
Now using the debug window I can see that the follwoing sinks in the chain
are as follows. Server = Dispatch and the Client = TcpClientTransport. I am
not convinced that I have it correct in my code. Does anybody have any
advice for me please cause I know I am the dummy but I am unable to get this
sorted.
Any help is much appreciated.
Thanx in advance.
Mike
Mike Groenewald - 08 Jul 2003 09:53 GMT
Thanx guys but I got it sorted.
Funny how you always get it sorted after you ask for help.
This is what I ended up using on the server side.
public static IServerChannelSinkProvider ServerChannelSinkProvider
{
get
{
IServerChannelSinkProvider returnObject = new
SecurityServerChannelSinkProvider(RemotingHelper.SecurityDictionaryBuilder()
, null);
returnObject.Next = new BinaryServerFormatterSinkProvider();
return returnObject;
}
}
Am not 100% sure why this would be the case but am doing some finding out
about the whole thing. My sponsor is is not working with the
security sinks so I am going to look at extending the RealProxy object as
well incase I get exceptions via timeouts etc. Is this the proper way of
handling
the Remoting Exception scenario?
Thanxs guys.