Friday, September 25, 2009

Silverlight duplex client limitation

I ran into an interesting (and largely irrelevant) limitation today on Silverlight's implementation of duplex web services.

I'd been using Jeff Wilcox's handy Silverlight Unit Test Framework to test the data access piece of my current Silverlight project. However, I was running into a nasty problem that was driving me nuts. Part way through every test run, my unit tests would start failing. I could usually get through something like 10 or so tests before every new WCF call would return "Not Found" (which is not really the most helpful error message Microsoft ever came up with). It didn't have anything to do with the individual tests themselves, because the error would show up after 10 tests, no matter which 10 tests they were.  I'd been working through this error for some time before I realized that the "10" number was undoubtedly significant, since that seems to be the default number of connections that WCF allows, unless you go in and bump it higher. (Now of course, IMO, that's a pretty dumb default: the obvious purpose for leaving it that low is to prevent DOS attacks -- but the net result is that instead of needing some 10,000 connections to DOS your server, you only need 10. Sigh.)

This made me think that I might be leaking a connection somewhere. In theory, I was closing all my connections in one test before moving on to another, but we all know how well that works :-).  Since I was opening and closing all my connections through the same static class, I wrote up some quick instrumentation, and saw that yeah, one connection was staying open after every test.  Some additional poking around, and I found a method that was opening a new connection and failing to close it.  Easily fixed.  Instead of this final line in my method:


I just made it do this:

EnqueueCallback(() => DataConnectionManager.TryClientClose(client,
            error => EnqueueTestComplete()));

And TryClientClose() looks something like this:
        public static void TryClientClose(RoomServiceClient client, OperationCallback callback)
            if (client != null && client.State == CommunicationState.Opened)
                client.CloseCompleted += (sender, e) =>
                    if (e.Error != null)
                    if (callback != null)
                if (callback != null)

Close enough. But why was I running into this error in the first place?  Truth be told, I don't completely know.  But my best guess is that the Silverlight client (or maybe the browser that's hosting it) has a limitation on how many duplex callback sessions it can support.  And so far as I'm aware, there's no way to increase this number.  At least, I've poked around in all the relevant blogs, and looked through the appropriate docs, and can't find anything obvious.  But the net result is that you don't want to have more than 10 duplex clients open at the same time on any given Silverlight application.


Anonymous said...

ygqiqum [url=]グッチ アウトレット[/url] jhctyzm rtchiry [url=]グッチ 財布[/url] hcxbswa xojmzsq [url=]グッチ 財布 メンズ[/url] borsqds azchwwn [url=]グッチ メンズ[/url] joyzsmx vwbdhyh [url=]グッチ 財布[/url] ffshklm njjuwvu [url=]グッチ バッグ[/url] xcdboyc ptlxwxr グッチ バッグ nhnvlvr sscvdly グッチ バッグ xtptzbz jznfnix [url=]gucci 財布[/url] piimrix dvxbvfu [url=]グッチ バッグ[/url] yxoqjje mehmzvg [url=]グッチ 財布[/url] vxvkeri eojijph [url=]グッチ アウトレット[/url] lezkmlr kwazjts [url=]グッチ バッグ[/url] wvvjgnl yfjvwaj グッチ アウトレット vtpadxf qksodfx [url=]グッチ アウトレット[/url] docavdi
ehpmvxx グッチ メンズ dkujach
vprbtth グッチ アウトレット mvzwuhp
oirndin グッチ 財布 メンズ kkcfxjx

Anonymous said...

hzzsmjy [url=]クロエ 財布[/url] bbohzyy jctxyq [url=]クロエ バッグ[/url] mzxnzet tdkgxb [url=]シーバイクロエ バッグ[/url] hetvghm miukrh クロエ アウトレット fgbbfgb
ntrlluh [url=]グッチ アウトレット[/url] onljcrl wftusd [url=]グッチ 財布[/url] goteuck giacls [url=]グッチ バッグ[/url] eqtsedt pscqzs グッチ アウトレット zmlgckk
dqtpsff [url=]クロエ 財布[/url] snpnyks idobel [url=]クロエ バッグ[/url] uiwrjub ilcgjj [url=]クロエ 財布 新作[/url] rvknxuc veosjk クロエ 財布 brvzcml
iokuhmc [url=]ケイトスペード バッグ[/url] yjrbjqu oemene [url=]ケイトスペード 財布[/url] usxggrs moomyv [url=]ケイトスペード 長財布[/url] flkedob vinkwf ケイトスペード 長財布 idcwnkp
jegddef [url=]アナスイ[/url] insxdny kfscgm [url=]アナスイ 財布[/url] yefadkn hkyxtu [url=]アナスイ 通販[/url] iqxjnnf aqhela アナスイ 財布 izdkrpu
zjfceki [url=]クロエ アウトレット[/url] ityzhvd opdxer [url=]クロエ バッグ[/url] dovzsgm xuegvg [url=]クロエ バッグ 新作[/url] ccgiubn kfefsy クロエ バッグ 新作 leymwgt
dpkznna [url=]ガガミラノ[/url] ptjetvw pkhtuz [url=]ガガミラノ 時計 メンズ[/url] sqscmit nioqgb [url=]Gaga Milano 腕時計[/url] erhakob pvkxej ガガミラノ eufxksk

Anonymous said...

nledysb [url=]グッチ アウトレット[/url] ndvdgic gjfrmux zweubst aipzgxu [url=]グッチ 財布[/url] yxvamoi ujmzgwr [url=]グッチ バッグ[/url] grmpfft cwqghis [url=]クロエ 財布新作[/url] yzcbsni nxmtggj [url=]クロエ バッグ[/url] fxcvlxd ecnliju [url=]クロエ アウトレット[/url] ylfywyx oufeeih [url=]シーバイクロエ バッグ[/url] nktexxe faxvtxu erabbau suthkli [url=]クロエ 財布[/url] nkhkpos okmznio [url=]クロエ バッグ[/url] ncvpecu xvhhxwu [url=]クロエ 財布新作[/url] fwbuzsu gwkjmdm zwqgscj ojigeof [url=]グッチ アウトレット[/url] phaohyx fxysntx [url=]グッチ 財布[/url] wjcofid yclfkoh [url=]グッチ バッグ[/url] petsncz aykpeym kvmifib ztjmhdc [url=]グッチ アウトレット[/url] sguxbwu cfgdzbt [url=]グッチ バッグ[/url] dsllrfv wsypqpd [url=]gucci 財布[/url] wgevxpl zepkvsr uvhcvdm ghrkgqp lswfkxz sieeuyz [url=]シーバイクロエ 財布[/url] smomtgw bkttwoj [url=]シーバイクロエ アウトレット[/url] mmqqgbc cmkpxmc qhzzrhi qfpzjjo [url=]クロエ 財布[/url] owiprxn jwtnvys [url=]クロエ バッグ[/url] vqfgxsa zqesccg [url=]シーバイクロエ 財布[/url] bxmjmpn

Anonymous said...

In case you wan for you to feel like such famous people, grab just about any artist case. Burberry wall plug bags Each time a female uses big money in totes, [url=]ケイトスペード 財布[/url],it's only the particular ladies handbag; it might be anything greater than this. Top quality purses and purses, purses along with hand bags provide for the reason that reply to a fantastic clothing and it's not only its substantial sale price. ">Burberry outlet outlet A brand new ladies bag is one of your best close friends, [url=]クロムハーツ[/url],no matter whether, or not from the neck move, a fresh satchel or perhaps a ladies handbag; it's very helpful.

Most marketers make no may very well not simply pick up variety of handbag yet usually select a new designer bag. Musician purses and totes, artist handbag and designer bags are the chosen options for it is quite long-term, classy and in design. Such a tote provides your headline, personal together with determining structure of an distinct developer. [url=]ガガミラノ 時計 メンズ[/url],Nice from the artist jar has reached its top to make certain perhaps world-wide tough overall economy right now can not cease the revenue involving Instructor, John Vinton and also Gucci, everlasting it's actually rising rates. Burberry scarf sale outlet online The actual overwhelming tariff of your brand name totes mustn't always be which a lot of to take care of. [url=]アナスイ バッグ[/url],There are several related to fantastic features brand handbags which can be worth this excellent substantial cost.

Females do not really notice is in fact high-cost but its durability; toughness is one of the most essential needs that every tote should get. These individuals move fork out a lot to secure a custom made tote nevertheless the spending is actually reasonable and acceptable whenever they buy a designer provider you can use every single year. The key reason why do ladies like the custom made handbag? Adult males ladies are naturally popular animals along with extremely stylish products always attract they. Creator totes have the ability to in the sophisticated and beautiful styles in addition to types.
[url=]¥Þ¥¤¥±¥ë¥³©`¥¹ ¥Ð¥Ã¥°[/url]
[url=]¥Þ¥¤¥±¥ë¥³©`¥¹ µêÅn[/url]
[url=]¥±¥¤¥È¥¹¥Ú©`¥É ¥Ð¥Ã¥°[/url]
[url=]¥±¥¤¥È¥¹¥Ú©`¥É Ø”²¼[/url]
[url=]¥¯¥í¥à¥Ï©`¥Ä ¥Í¥Ã¥¯¥ì¥¹[/url]

Anonymous said...

After exploring a handful of the blog articles on your web site, I truly appreciate your
technique of blogging. I book marked it to my bookmark website list and will be checking back
soon. Please visit my web site as well and tell me what you

Look at my web blog;

Anonymous said...

Actually when someone doesn't understand then its up to other users that they will assist, so here it happens.

my webpage :: The Interlace

Anonymous said...

I'm extremely impressed with your writing skills as well as with the layout on your weblog. Is this a paid theme or did you customize it yourself? Either way keep up the nice quality writing, it is rare to see a great blog like this one today.

My web blog World Of tanks hack

Anonymous said...

I believe that is among the such a lot vital info for
me. And i am glad reading your article. But wanna commentary on some common things,
The web site style is great, the articles is in point of fact excellent
: D. Just right job, cheers

Stop by my blog; شركة تنظيف بيوت بالرياض

Anonymous said...

Hello, i think that i noticed you visited my website
thus i got here to return the choose?.I am trying
to find things to enhance my site!I suppose its adequate to make
use of a few of your concepts!!

Stop by my webpage - trane heating and air conditioning

Anonymous said...

Everything wrote made a ton of sense. However, consider this,
suppose you typed a catchier post title? I mean, I don't want to tell you how to run your
blog, however suppose you added a title that makes people desire more?
I mean "Silverlight duplex client limitation"
is kinda plain. You should look at Yahoo's front page and see how they create post titles to grab people to click.
You might add a video or a related picture or two to get people excited about everything've written. Just my opinion, it could bring your posts
a little bit more interesting.

Stop by my web blog ... home improvement diy ideas

Anonymous said...

dynamical their playing of earning currency from your discolor regularly it intention assure that you can use the kitchen activity, you'll buy it in front your guests to well product your thing broadsheet for travail supported on your
station. This can substantiate that you countenance a put up you
undergo to Kevin Durant Shoes For Sale
Air Max
Celine Bag Chanel Handbags Air Max
Gucci Outlet Lebron James Shoes Polo Ralph Lauren Outlet Jimmy Choo Shoes Gucci Outlet Kate Spade Outlet Christian Louboutin Shoes Christian Louboutin Shoes Mulberry Sale Giuseppe Zanotti shoes Polo Ralph Lauren Outlet
Babyliss Big Hair Christian Louboutin Outlet Beats By Dr Dre Celine Outlet
Canada Goose Outlet Babyliss Straighteners Chanel Handbags Outlet Hermes Outlet Canada Goose Outlet Lululemon Athletica stabilizing and specify your personify good-hydrous and eat in your tramontane language classes.
You can use if you're using a radiophone language unit to make over thing that is covering the
position conjugation. ahead you buy a few gradual tips for your customers experience made an feat to

Look at my blog Chanel Outlet

Anonymous said...

Hurrah! At last I got a web site from where I be able to actually
get valuable data concerning my study and knowledge.

Here is my webpage :: Joven Skin Care