I am absolutely bewildered by now by the Microsoft.Samples SSPI and Security
assemblies. I've been trying to set these up in a very straightforward
harness in the way that I'd like to be able to use them. No IIS. Use TCP,
binary. Standard server example with a console host and console client. .NET
1.1, windows XP. (I tried posting to the remoting newsgroup, no answers in
the last couple days, trying here in hopes that more people watch this
group)
I've looked all over, trying to figure out what is going on. I've come
across people reporting similar issues, but no resolution ever seems to be
posted in response. The Host seems to start up fine and be listening. The
constructor for the server object even seems to be called ok. The code for a
particular method/property even seems to execute. I've traced the error into
the ChannelSinkCallContext.DeserializeStringToChannelS inkCallContext shown
in the dump. For some reason, at some point, a call to
nextSink.ProcessMessage returns responseHeaders with no
"ChannelSinkCallContext" header and this in turn passes on to
DeserializeStringToChannelSinkCallContext as a null which blows up when
Convert.FromBase64String tries to operate on it.
I've tried everything I can think of in the config files. any suggestions?
If I comment out the provider entities in the below configs everything runs
great. as soon as i try to enable the Security assembly, it blows chunks.
Does it not work with Framework 1.1? XP?
Everytime I try to call a method or property I end up with:
Unhandled Exception: System.ArgumentNullException: Value cannot be null.
Parameter name: InString
Server stack trace:
at System.Convert.FromBase64String(String s)
at
Microsoft.Samples.Runtime.Remoting.Security.Channe lSinkCallContext.Deseriali
zeStringToChannelSinkCallContext(String serializedGraph) in
d:\code\msremote\security\securitysink.cs:line 404
at
Microsoft.Samples.Runtime.Remoting.Security.Securi tyChannelSink.SendMessageT
oServerSink(ClientContext clientContext, IClientChannelSink nextSink,
ChannelSinkCallContext channelSinkCallContext, IMessage msg,
ITransportHeaders requestHeaders, Stream requestStream,
ITransportHeaders&responseHeaders, Stream& responseStream) in
d:\code\msremote\security\securitysink.cs:line 643
at
Microsoft.Samples.Runtime.Remoting.Security.Securi tyClientChannelSink.Proces
sMessage(IMessage msg, ITransportHeaders requestHeaders,
StreamrequestStream, ITransportHeaders& responseHeaders, Stream&
responseStream)
in d:\code\msremote\security\securitysink.cs:line 940
at
System.Runtime.Remoting.Channels.BinaryClientForma tterSink.SyncProcessMessag
e(IMessage msg)
Exception rethrown at [0]:
at
System.Runtime.Remoting.Proxies.RealProxy.HandleRe turnMessage(IMessagereqMsg
, IMessage retMsg)
at
System.Runtime.Remoting.Proxies.RealProxy.PrivateI nvoke(MessageData&msgData,
Int32 type)
at Server.ServerEx.DoNothing() in
d:\code\msremote\server\serverex.cs:line 20
at Client.ClientEx.Main() in D:\Code\MSRemote\Client\ClientEx.cs:line 13
<!-- Server Config -->
<configuration>
<system.runtime.remoting>
<debug loadTypes="true" />
<application>
<channels>
<channel ref="tcp" port="8080">
<serverProviders>
<formatter ref="binary" typeFilterLevel="Full" />
<provider
type="Microsoft.Samples.Runtime.Remoting.Security. SecurityServerChannelSinkP
rovider, Microsoft.Samples.Runtime.Remoting.Security"
securityPackage="ntlm" authenticationLevel="call" />
</serverProviders>
</channel>
</channels>
<service>
<wellknown mode="Singleton" type="Server.ServerEx, Server"
objectUri="Server.rem"/>
</service>
</application>
</system.runtime.remoting>
</configuration>
--------------------------------------------------------
<!-- Client Config -->
<configuration>
<system.runtime.remoting>
<debug loadTypes="true" />
<application>
<channels>
<channel ref="tcp">
<clientProviders>
<formatter ref="binary" />
<provider
type="Microsoft.Samples.Runtime.Remoting.Security. SecurityClientChannelSinkP
rovider, Microsoft.Samples.Runtime.Remoting.Security"
securityPackage="ntlm" impersonationLevel="impersonate"
authenticationLevel="call" />
</clientProviders>
</channel>
</channels>
<client>
<wellknown type="Server.ServerEx, Server"
url="tcp://localhost:8080/Server.rem"/>
</client>
</application>
</system.runtime.remoting>
</configuration>
---------------------------------------------------------------
// server code
using System;
using System.Diagnostics;
namespace Server {
public class ServerEx : MarshalByRefObject {
private DateTime _dt = DateTime.Now;
public ServerEx() {
Debug.WriteLine("constructor");
}
public void DoNothing() {
Debug.WriteLine("did nothing");
}
public DateTime CreateTime {
get {
return _dt;
}
}
}
}
------------------------------------------------------------------
// host code
using System;
using System.Runtime.Remoting;
namespace Host {
public class HostEx {
public static void Main(){
RemotingConfiguration.Configure("Host.exe.config") ;
Console.WriteLine("Listening for requests. Press Enter to exit...");
Console.ReadLine();
}
}
}
----------------------------------------------------------------
//client code
using System;
using System.Runtime.Remoting;
namespace Client {
public class ClientEx {
public static void Main(){
RemotingConfiguration.Configure("Client.exe.config ");
Server.ServerEx remoteObject = new Server.ServerEx();
remoteObject.DoNothing();
remoteObject.DoNothing();
remoteObject.DoNothing();
Console.WriteLine(remoteObject.CreateTime);
Console.ReadLine();
}
}
}