Proble with ClientSponsor
I use IIS to host my CAO. And run WinForms App as a client. Everything is fine except my server instance becomes unreachable after approximately 5 minutes of client being idle. Now I’m trying to use ClientSponsor to solve the problem but it doesn’t work. What is wrong in my code?
Server config file:
Client code:
IDictionary props = new Hashtable();
props["credentials"] = CredentialCache.DefaultCredentials;
props["port"] = 4001;
props["useDefaultCredentials"] = "true";
props["typeFilterLevel"] = "Full";
HttpChannel channel = new HttpChannel(props,
new BinaryClientFormatterSinkProvider(),
new BinaryServerFormatterSinkProvider());
ChannelServices.RegisterChannel(channel);
ActivatedClientTypeEntry atEntry =
new ActivatedClientTypeEntry(typeof(ServerClass),
"http://localhost:80/Server");
RemotingConfiguration.RegisterActivatedClientType(atEntry);
ServerClass instance = new ServerClass();
ClientSponsor sponsor = new ClientSponsor(TimeSpan.FromMinutes(5));
if (!sponsor.Register(instance))
throw(new Exception("Couldn't register sponsor."));
instance.Connect();

shimtannyRank #3,312 · 434 pointsPosted Jan 7, 2005, 1:53 AM EST
pl115 pointsPosted Jan 7, 2005, 4:14 AM EST
shimtannyRank #3,312 · 434 pointsPosted Jan 10, 2005, 2:38 AM EST
pl115 pointsPosted Jan 11, 2005, 9:22 AM EST
shimtannyRank #3,312 · 434 pointsPosted Jan 11, 2005, 1:35 PM EST
pl115 pointsPosted Jan 12, 2005, 12:14 AM EST
pl115 pointsPosted Jan 12, 2005, 10:54 AM EST
shimtannyRank #3,312 · 434 pointsPosted Jan 12, 2005, 11:42 PM EST
pl115 pointsPosted Jan 13, 2005, 10:40 AM EST
shimtannyRank #3,312 · 434 pointsPosted Jan 14, 2005, 1:23 AM EST
pl115 pointsPosted Jan 14, 2005, 2:20 AM EST
shimtannyRank #3,312 · 434 pointsPosted Jan 14, 2005, 2:50 AM EST
pl115 pointsPosted Jan 14, 2005, 8:44 AM EST