Tech
Forums
Jobs
Books
Events
Videos
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
13
Answers
Proble with ClientSponsor
pl1
20y
6.4k
1
Reply
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();
Post
Reset
Cancel
Answers (
13
)
Next Recommended Forum
To bind to Datagrids
c# - redirecting in usercontrol