all groups > dotnet remoting > april 2008 >
You're in the

dotnet remoting

group:

Remoting hangs when tcp client is missing 'channel' element



Remoting hangs when tcp client is missing 'channel' element roger.orr@gmail.com
4/10/2008 1:14:43 PM
dotnet remoting: Hello,
I am finding that if the remoting client is misconfigured then client
calls can hang.

I'm using .Net 2.0 and secure tcp remoting.
Server side:

<!-- Remoting hosting section -->
<system.runtime.remoting>
<customErrors mode="off"/>
<application>
<service>
<wellknown mode="SingleCall"
type="Service.ServiceImplementation, Service" objectUri="server.rem" /
[quoted text, click to view]
</service>
<channels>
<channel ref="tcp" secure="true" port="8080" />
</channels>
</application>
</system.runtime.remoting>
</configuration>

Client side:- this setting works:

<system.runtime.remoting>
<customErrors mode="off"/>
<application>
<channels>
<channel ref="tcp" secure="true" impersonate="true"
tokenImpersonationLevel="Impersonation"/>
</channels>
</application>
</system.runtime.remoting>

If I remove the <channel> element I get no errors reported on either
end of the connection, but the client side hangs 'for ever' [got bored
after many minutes].
There is still a TCP session active, and if I exit the server then the
client fails immediately.

Does anyone know if there is a way to alter/detect/diagnose this
hang ?
In the overall system - more complex than this example - it is
sometimes very hard to diagnose this sort of configuration problem.

Regards,
RE: Remoting hangs when tcp client is missing 'channel' element Kevin J. Stricklin
5/19/2008 9:53:00 AM
The problem due to the way the security negotiation works. If you don't add
the channel element to your config file, Remoting defaults to an unsecure
connection. When two Remoting processes attempt to establish a connection
where one is secure and the other isn't, they "hang". Once side is waiting
for more security information and the other side is waiting for more Remoting
Re: Remoting hangs when tcp client is missing 'channel' element PSzalapski@gmail.com
5/23/2008 1:02:19 PM
On May 19, 11:53 am, Kevin J. Stricklin
[quoted text, click to view]

I am encountering a very similar problem. I have a secure TCP channel
here, and I have the client and the server running on the same box to
rule out any domain/trust issues. The first time I try to use the
remote object, it hangs. Does anyone have any idea how I can debug
this to find out what is wrong?

In case it matters, here is the server code (not using the config
files like earlier in this thread):

BinaryServerFormatterSinkProvider provider = new
BinaryServerFormatterSinkProvider();
provider.TypeFilterLevel =
System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;

Hashtable channelProperties = new Hashtable();
channelProperties.Add("port", 9765); // define the port
channelProperties.Add("secure", true);
channelProperties.Add("impersonate", true);
channelProperties.Add("name", "myname1");
ChannelServices.RegisterChannel(new TcpChannel(channelProperties,
null, provider), false);

WellKnownServiceTypeEntry entry = new
WellKnownServiceTypeEntry(typeof(MyService), "MyService.rem",
WellKnownObjectMode.SingleCall);

RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off;
RemotingConfiguration.RegisterWellKnownServiceType(entry);

Client code:

Hashtable channelProperties = new Hashtable();
channelProperties.Add("secure", true);
channelProperties.Add("tokenImpersonationLevel", "Impersonation");
channelProperties.Add("connectionTimeout", 5000);
channelProperties.Add("name", "myname1");
TcpClientChannel clientChannel = new
TcpClientChannel(channelProperties, null);
ChannelServices.RegisterChannel(clientChannel, false);
RemotingConfiguration.RegisterWellKnownClientType(typeof(IMyService),
"tcp://localhost:9765/MyService.rem");

IMyService myService =
(ICardCommand)Activator.GetObject(typeof(IMyService), cardCommandUri);
myService.GetData(...) // this hangs; works when everything is
Re: Remoting hangs when tcp client is missing 'channel' element PSzalapski@gmail.com
5/23/2008 1:07:56 PM
Sorry, at the end of the client code, it should be:

IMyService myService =
(IMyService)Activator.GetObject(typeof(IMyService), "tcp://localhost:
9765/MyService.rem");
myService.GetData(...) // this hangs; works when everything is
instead set to not secure

[quoted text, click to view]
AddThis Social Bookmark Button