sathish
2008-09-16 13:58:56 UTC
Hi all,
I have a windows service in C#. This service configures the .NET
remoting service. This service is installed on a single PC. I have
1000+ clients which connects to the server via remoting. After some
200+ client connection, when a new client is suppose to get the
remoted object, client throws an exception "Invalid Argument was
Supplied".
Exception StackTrace:
at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot,
SocketAddress socketAddress)
at System.Net.Sockets.Socket.Bind(EndPoint localEP)
at System.Net.Sockets.TcpListener.Start(Int32 backlog)
at System.Net.Sockets.TcpListener.Start()
at
System.Runtime.Remoting.Channels.ExclusiveTcpListener.Start(Boolean
exclusiveAddressUse)
at
System.Runtime.Remoting.Channels.Tcp.TcpServerChannel.StartListening(Object
data)
at
System.Runtime.Remoting.Channels.Tcp.TcpServerChannel.SetupChannel()
at
System.Runtime.Remoting.Channels.Tcp.TcpServerChannel..ctor(IDictionary
properties, IServerChannelSinkProvider sinkProvider,
IAuthorizeRemotingConnection authorizeCallback)
at
System.Runtime.Remoting.Channels.Tcp.TcpChannel..ctor(IDictionary
properties, IClientChannelSinkProvider clientSinkProvider,
IServerChannelSinkProvider serverSinkProvider)
Client Side Remoting Code:
//serialization formatter
BinaryServerFormatterSinkProvider serverProv = new
BinaryServerFormatterSinkProvider();
//declare the level to be full
serverProv.TypeFilterLevel =
System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
//serialization formatter
BinaryClientFormatterSinkProvider clientProv = new
BinaryClientFormatterSinkProvider();
IDictionary props = new Hashtable();
//holds port number
props["port"] = 0;
//port name is empty
props["name"] = string.Empty;
//filter level will be full
props["typeFilterLevel"] =
System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
//tcp channel for communication
clientChannel = new TcpChannel(props, clientProv,
serverProv); //-----> This the Line which throws the Exception
//register the channel
ChannelServices.RegisterChannel(clientChannel, true);
// if the ip address details was not found in the app
config file
// or anyother errorr occured in the same, then
// connect to a default host running in the same
machine.
if (ServerIp == "")
{
ServerIp = "127.0.0.1";
}
connString = string.Format("tcp://{0}:4242/
RemoteClass", ServerIp);
remoteServObject =
(RemoteClass)Activator.GetObject(typeof(RemoteClass), connString);
retVal = true;
}
//Any Exception ???
catch (Exception ex)
{
// unregistering the channel from the .NET framework
as the client is being disposed.
ChannelServices.UnregisterChannel(clientChannel);
retVal = false;
}
Server Side Remoting Code:
BinaryServerFormatterSinkProvider servProvider = new
BinaryServerFormatterSinkProvider();
servProvider.TypeFilterLevel =
System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
// Creating a Client sink provider.
BinaryClientFormatterSinkProvider clientProvider = new
BinaryClientFormatterSinkProvider();
// Creating a hashtable entry, for the port num to be
used.
IDictionary portNo = new Hashtable();
// Setting the port num to listen for an incomming
request.
portNo["port"] = "4242";
portNo["name"] = string.Empty;
portNo["typeFilterLevel"] =
System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
// try catch exceptions.
try
{
// Creating a TCP channel for listening new
connections.
tcpServChannel = new TcpChannel(portNo,
clientProvider, servProvider);
// Regestering the Channel with the DotNet Remoting
framework.
ChannelServices.RegisterChannel(tcpServChannel,
true);
// Specifyin the object to be exposed via DotNet
remoting and also the manner in which to
// to expoert the object.
RemotingConfiguration.RegisterWellKnownServiceType(typeof(RemoteClass),
"RemoteClass",
WellKnownObjectMode.Singleton);
// Checking if the object was successfully exported
via DotNet remoting, by tryin to create
// an instance of the object here it
self.
firstInstance =
(RemoteClass)Activator.GetObject(typeof(RemoteClass),
"tcp://localhost:4242/RemoteClass");
ILease leaseTime =
(ILease)firstInstance.InitializeLifetimeService();
}
// any exceptions occured ?
catch (Exception err)
{
ChannelServices.UnregisterChannel(tcpServChannel);
throw err;
}
Any Help is most Welcome. Thanks in Advance.
-Sathish B.R.
I have a windows service in C#. This service configures the .NET
remoting service. This service is installed on a single PC. I have
1000+ clients which connects to the server via remoting. After some
200+ client connection, when a new client is suppose to get the
remoted object, client throws an exception "Invalid Argument was
Supplied".
Exception StackTrace:
at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot,
SocketAddress socketAddress)
at System.Net.Sockets.Socket.Bind(EndPoint localEP)
at System.Net.Sockets.TcpListener.Start(Int32 backlog)
at System.Net.Sockets.TcpListener.Start()
at
System.Runtime.Remoting.Channels.ExclusiveTcpListener.Start(Boolean
exclusiveAddressUse)
at
System.Runtime.Remoting.Channels.Tcp.TcpServerChannel.StartListening(Object
data)
at
System.Runtime.Remoting.Channels.Tcp.TcpServerChannel.SetupChannel()
at
System.Runtime.Remoting.Channels.Tcp.TcpServerChannel..ctor(IDictionary
properties, IServerChannelSinkProvider sinkProvider,
IAuthorizeRemotingConnection authorizeCallback)
at
System.Runtime.Remoting.Channels.Tcp.TcpChannel..ctor(IDictionary
properties, IClientChannelSinkProvider clientSinkProvider,
IServerChannelSinkProvider serverSinkProvider)
Client Side Remoting Code:
//serialization formatter
BinaryServerFormatterSinkProvider serverProv = new
BinaryServerFormatterSinkProvider();
//declare the level to be full
serverProv.TypeFilterLevel =
System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
//serialization formatter
BinaryClientFormatterSinkProvider clientProv = new
BinaryClientFormatterSinkProvider();
IDictionary props = new Hashtable();
//holds port number
props["port"] = 0;
//port name is empty
props["name"] = string.Empty;
//filter level will be full
props["typeFilterLevel"] =
System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
//tcp channel for communication
clientChannel = new TcpChannel(props, clientProv,
serverProv); //-----> This the Line which throws the Exception
//register the channel
ChannelServices.RegisterChannel(clientChannel, true);
// if the ip address details was not found in the app
config file
// or anyother errorr occured in the same, then
// connect to a default host running in the same
machine.
if (ServerIp == "")
{
ServerIp = "127.0.0.1";
}
connString = string.Format("tcp://{0}:4242/
RemoteClass", ServerIp);
remoteServObject =
(RemoteClass)Activator.GetObject(typeof(RemoteClass), connString);
retVal = true;
}
//Any Exception ???
catch (Exception ex)
{
// unregistering the channel from the .NET framework
as the client is being disposed.
ChannelServices.UnregisterChannel(clientChannel);
retVal = false;
}
Server Side Remoting Code:
BinaryServerFormatterSinkProvider servProvider = new
BinaryServerFormatterSinkProvider();
servProvider.TypeFilterLevel =
System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
// Creating a Client sink provider.
BinaryClientFormatterSinkProvider clientProvider = new
BinaryClientFormatterSinkProvider();
// Creating a hashtable entry, for the port num to be
used.
IDictionary portNo = new Hashtable();
// Setting the port num to listen for an incomming
request.
portNo["port"] = "4242";
portNo["name"] = string.Empty;
portNo["typeFilterLevel"] =
System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
// try catch exceptions.
try
{
// Creating a TCP channel for listening new
connections.
tcpServChannel = new TcpChannel(portNo,
clientProvider, servProvider);
// Regestering the Channel with the DotNet Remoting
framework.
ChannelServices.RegisterChannel(tcpServChannel,
true);
// Specifyin the object to be exposed via DotNet
remoting and also the manner in which to
// to expoert the object.
RemotingConfiguration.RegisterWellKnownServiceType(typeof(RemoteClass),
"RemoteClass",
WellKnownObjectMode.Singleton);
// Checking if the object was successfully exported
via DotNet remoting, by tryin to create
// an instance of the object here it
self.
firstInstance =
(RemoteClass)Activator.GetObject(typeof(RemoteClass),
"tcp://localhost:4242/RemoteClass");
ILease leaseTime =
(ILease)firstInstance.InitializeLifetimeService();
}
// any exceptions occured ?
catch (Exception err)
{
ChannelServices.UnregisterChannel(tcpServChannel);
throw err;
}
Any Help is most Welcome. Thanks in Advance.
-Sathish B.R.