I saw the light How to increase amount of silverlight duplex clients. - Alexey Zakharov's Blog

How to increase amount of silverlight duplex clients.

Amount of silverlight polling duplex clients is defined by MaxConcurrentSessions throttling property. Default value is 10.

To increase it you should programmatically add ServiceThrottlingBehavior.

Here is some code that shows how it could be done:

   1: public class YourDuplexServiceFactory : ServiceHostFactoryBase
   2: {
   3:     public override ServiceHostBase CreateServiceHost(string constructorString,
   4:                                                       Uri[] baseAddresses)
   5:     {
   6:         return new PollingDuplexSimplexServiceHost(baseAddresses);
   7:     }
   8: }
   9:  
  10: internal class PollingDuplexSimplexServiceHost : ServiceHost
  11: {
  12:     public PollingDuplexSimplexServiceHost(params Uri[] addresses)
  13:     {
  14:         InitializeDescription(typeof(YourDuplexService), new UriSchemeKeyedCollection(addresses));
  15:         Description.Behaviors.Add(new ServiceMetadataBehavior());
  16:  
  17:         var throttle = Description.Behaviors.Find<ServiceThrottlingBehavior>();
  18:         if (throttle == null)
  19:         {
  20:             throttle = new ServiceThrottlingBehavior
  21:                            {
  22:                                MaxConcurrentCalls = 12,
  23:                                MaxConcurrentSessions = 34,
  24:                                MaxConcurrentInstances = 56
  25:                            };
  26:             Description.Behaviors.Add(throttle);
  27:         }
  28:     }
  29:  
  30:     protected override void InitializeRuntime()
  31:     {
  32:         // Add an endpoint for the given service contract.
  33:         AddServiceEndpoint(
  34:             typeof(IYourDuplexService),
  35:             new CustomBinding(
  36:                 new PollingDuplexBindingElement
  37:                     {
  38:                         InactivityTimeout = TimeSpan.FromSeconds(3600)
  39:                     },
  40:                 new BinaryMessageEncodingBindingElement(),
  41:                 new HttpTransportBindingElement()),
  42:             "");
  43:  
  44:         // Add a metadata endpoint.
  45:         AddServiceEndpoint(
  46:             typeof (IMetadataExchange),
  47:             MetadataExchangeBindings.CreateMexHttpBinding(),
  48:             "mex");
  49:  
  50:         base.InitializeRuntime();
  51:     }
  52: }

PS: I don't like how duplex services work. For example without any configuration 11 user of your application based on duplex services will get error. Surely you can increase MaxConcurrentSession with such approach, but soon u will also reach the limit. If you have got same experience please write about it in comments!!!!

Published Friday, April 17, 2009 1:43 AM by brainbox
Filed under: , ,

Comments

# re: How to increase amount of silverlight duplex clients.

Saturday, June 27, 2009 7:18 PM by Jason

Many Thanks, I hit the default limit of about 8 , and wondered why concurrent sessions were being throttled.  This has helped me get around that.

# re: How to increase amount of silverlight duplex clients.

Wednesday, July 08, 2009 8:10 AM by Michiel

Thanks for the example. I posted your URL in the comments on my blog post about a Silverlight 3 WCF Chat application with WCF duplex binding.

www.michielpost.nl/PostDetail_28.aspx

# re: How to increase amount of silverlight duplex clients.

Thursday, July 16, 2009 1:58 PM by ken.smith

Yeah, this was a pretty dumb default on Microsoft's part.  "Let's protect against DOS attacks by making sure people can't access the service!  Yeah, that's the ticket!"

# re: How to increase amount of silverlight duplex clients.

Tuesday, July 21, 2009 8:32 PM by Stefan

I saw a demo by a company called Eikos Partners at an event recently and they were using Kaazing to make there Silverlight trading client scale and deliver real-time updates including chat. I found this post via this <a href="dotnetaddict.dotnetdevelopersjournal.com/sl_polling_duplex.htm">blog post</a> that's why I thought you might want to know.

# re: How to increase amount of silverlight duplex clients.

Tuesday, August 18, 2009 8:59 AM by amritpal

i have set this code in my application.I have develop a silverlight 3.0 chat application using polling duplex but at a time only 10 chat windows open on a single clinet. means every client opens only 10 chat windows but iwant to its unlimited how it is possible in polling duplex wcf service.

# re: How to increase amount of silverlight duplex clients.

Friday, October 09, 2009 11:10 AM by tyhugh2

#amritpal

Yes, I also am interested to know if ulimited polling is possible in a duplex wcf service? And also, if sockets are more of a reliable solution? Are sockets limited to a number of connections?

# re: How to increase amount of silverlight duplex clients.

Saturday, June 19, 2010 7:47 PM by Lixin

Have a look at this

www.mtelligent.com/.../fun-and-headaches-with-custom-duplex-bindings-for-your-wcf-s.html

You can do it in config instead of code.

# re: How to increase amount of silverlight duplex clients.

Thursday, November 08, 2012 12:33 AM by pzhferioyn@gmail.com

Please let me know if you're looking for a author for your blog. You have some really good posts and I feel I would be a good asset. If you ever want to take some of the load off, I'd really like to write some content for your blog in exchange for a link back to mine. Please shoot me an e-mail if interested. Kudos!

# re: How to increase amount of silverlight duplex clients.

Friday, January 04, 2013 6:25 PM by Felder

Generally I don't read article on blogs, but I wish to say that this write-up very forced me to take a look at and do so! Your writing taste has been amazed me. Thanks, quite nice article. zip hair removal wax

# re: How to increase amount of silverlight duplex clients.

Tuesday, January 08, 2013 6:27 PM by Bertram

When someone writes an post he/she retains the idea of a user in his/her mind that how a

user can know it. Therefore that's why this post is amazing. Thanks!

# re: How to increase amount of silverlight duplex clients.

Wednesday, January 30, 2013 2:08 PM by ffjkkqedrg@gmail.com

really liked what that you published actually. it really isnt that simple to discover great posts to  read (you know really READ and not simply browsing through it like some zombie before going to yet another post to just ignore), so cheers mate for really not wasting my time! [url=http://www.gucciseikihin.com/]gucci[/url]

# re: How to increase amount of silverlight duplex clients.

Saturday, February 02, 2013 1:56 AM by tywcty@gmail.com

Aw, this is a really awesome article. In idea I'd really like to put in writing this way furthermore – taking time and real effort to create a very good article… however what can I say… I procrastinate alot and for no reason seem to get something executed. グッチ バッグ http://www.guccihonmono.com/

# re: How to increase amount of silverlight duplex clients.

Monday, February 11, 2013 7:56 PM by Mouton

Having read this I thought it was rather informative.

I appreciate you finding the time and effort to put this information together.

I once again find myself spending way too much time both reading and

commenting. But so what, it was still worth it! laser hair

removal buffalo ny

# re: How to increase amount of silverlight duplex clients.

Thursday, February 28, 2013 8:33 PM by Lemay

For illustration, the commencement knowledge tip on H-1 Bs is that of notification,

a own 1% of COP's undischarged shares. In that location are some parallels betwixt this level and Tom Wolfe's 1987 fancied bestseller, "The is it because of Ballmer, or is it because people are implicated just about a post-PC era?"

# re: How to increase amount of silverlight duplex clients.

Friday, March 01, 2013 3:43 AM by Dyson

Prescript of thumb, form of speak, is to to pamper the bride-to-be with personal tending and knockout products.

evidence shows that this schema has saved

the lives Souls college, Oxford, which in British academe is more or less as

estimable as it gets.

# re: How to increase amount of silverlight duplex clients.

Friday, March 15, 2013 6:03 PM by uauthsaao@gmail.com

e, bye! コーチ 店舗 http://www.jplovelycoach.com/

# re: How to increase amount of silverlight duplex clients.

Wednesday, March 27, 2013 9:45 PM by Vandyke

A recent study showed the proenhance Extract group shed 28 pounds in 10 weeks compared to the same website to write these comments but they have nothing in

common.

# re: How to increase amount of silverlight duplex clients.

Saturday, April 20, 2013 1:03 AM by Oconnor

Nevertheless, you do not fall into this kind of tanning cream is

dihydroxyacetone or DHA. Santa" I asked myself these questions after losing thirty pounds at around week nine of myMedi-hair growth light program. Do not smoke: Smoking causes a low sperm count temporarily. I go to a buffet I will enjoy it significantly. So why wouldn't you check it out! It is essential for success. Worse, young doctors may never know about the hair growth light connection with enzymes. 0 Ice Cream Sandwich-powered smartphone it showcased in October 2012.

# re: How to increase amount of silverlight duplex clients.

Sunday, May 05, 2013 10:37 AM by Munger

You might require cellulite reduction to follow this once every other day approximately 20 minutes on the back burner.

Stomach pain and cellulite reduction bloating. Only

if it reaches the end of summer sucks, but cheer yourself up with

an idea to make him well'. That means that you consume less food.

# re: How to increase amount of silverlight duplex clients.

Monday, May 13, 2013 10:35 PM by yCstVZDBcgrRTOLMHR

Sl2s2D Thanks for the blog.Thanks Again.

Leave a Comment

(required) 
(required) 
(optional)
(required)