WCF — Cross-machine semaphore with WCF

Came across an inter­est­ing ques­tion on Stack­Over­flow on how one might be able to throt­tle the num­ber of requests across mul­ti­ple servers run­ning the same WCF ser­vice. So for instance, if you have 3 servers sit­ting behind a load bal­ancer and for one rea­son or anoth­er you can only allow 5 requests to be made …

WCF — Cross-machine sem­a­phore with WCFRead More »

WCF — Be ware of the field ordering when using DataContractSerializer

One of the less known aspect of the Dat­a­Con­tract­Se­ri­al­iz­er is its depen­den­cy on the order in which fields are seri­al­ized and dese­ri­al­ized. As this arti­cle points out, the basic rules for order­ing include: If a data con­tract type is a part of an inher­i­tance hier­ar­chy, data mem­bers of its base types are always first in …

WCF — Be ware of the field order­ing when using Dat­a­Con­tract­Se­ri­al­iz­erRead More »

WCF — Data Contract version round-tripping using IExtensibleDataObject

With WCF, pro­vid­ed that you’re using the Dat­a­Con­tract­Se­ri­al­iz­er and not the Net­Dat­a­Con­tract­Se­ri­al­iz­er, you have a cer­tain degree of pro­tec­tion against data con­tract changes from the client’s per­spec­tive. Exist­ing con­tracts will still work if exist­ing mem­bers are not removed from the data con­tract, which means you are free to add new mem­bers to the data con­tract …

WCF — Data Con­tract ver­sion round-trip­ping using IEx­ten­si­ble­DataOb­jectRead More »

WCF — Using the NetDataContractSerializer to share your type

Dat­a­Con­tract­Se­ri­al­iz­er For those of your who are famil­iar with WCF you would no doubt know about the Dat­a­Con­tract­Se­ri­al­iz­er class, the Dat­a­Con­tract­Se­ri­al­iz­er does not include the CLR type infor­ma­tion in the seri­al­ized XML, which allows for loose cou­pling between the client and serv­er because they don’t have to share the same CLR types. How­ev­er, this also …

WCF — Using the Net­Dat­a­Con­tract­Se­ri­al­iz­er to share your typeRead More »

.Net Tips — Use Request and Response objects

We’ve all been there before, write a sim­ple ser­vice with a sim­ple method: As time goes by, the sim­ple method gets more com­pli­cat­ed, and the list of para­me­ters grows and even­tu­al­ly sim­ple method is over­loaded to pro­vide more vari­ety and sim­ple method is sim­ple no more! A sim­ple solu­tion to this is the Request-Response pat­tern, …

.Net Tips — Use Request and Response objectsRead More »

WCF — Improve performance with greater concurrency

As good and inno­v­a­tive as WCF is, it also intro­duced a lot of new com­plex­i­ties and whilst it is easy to get some­thing up and run­ning quick­ly it takes much more under­stand­ing to make your ser­vice per­form as well as it could. There are many things you need to con­sid­er such as bind­ing types, seri­al­iza­tion …

WCF — Improve per­for­mance with greater con­cur­ren­cyRead More »

.Net Tips — Using custom ServiceThrottlingAttribute to specify WCF service throttling behaviour

If you have cre­at­ed a WCF ser­vice in the past then I assume you’re aware that WCF is very heav­i­ly con­­fig­u­ra­­tion-dri­ven and that you can spec­i­fy the ser­vice behav­iour includ­ing the throt­tling para­me­ters (Max­Con­cur­rent­Calls, Max­Con­cur­rentIn­stances, Max­Con­cur­rentSes­sions) in the con­fig file. But to spec­i­fy the type of ser­vice (Per­Call, PerS­es­sion or Sin­gle­ton) you need to apply …

.Net Tips — Using cus­tom Ser­viceThrot­tlin­gAt­tribute to spec­i­fy WCF ser­vice throt­tling behav­iourRead More »

.Net Tips — using configSource or file attribute to externalize config sections

There’s a lit­tle known attribute which was intro­duced in the .Net frame­work 2.0 called con­fig­Source, which allows you to exter­nal­ize sec­tions of the con­fig­u­ra­tion file. It works just like the option­al file attribute found on the appSet­tings ele­ment: <appSet­tings file = “rel­a­tive file name” /> but can be added to any con­fig­u­ra­tion sec­tion to spec­i­fy …

.Net Tips — using con­fig­Source or file attribute to exter­nal­ize con­fig sec­tionsRead More »

DataContract Serialization by Reference using the IsReference Property

I came across this blog post the oth­er day which intro­duced to me a cool addi­tion to the Dat­a­Con­tract seri­al­iz­er — the abil­i­ty to gen­er­ate XML by ref­er­ence rather than by val­ue: http://www.zamd.net/2008/05/20/DataContractSerializerAndIsReferenceProperty.aspx Not much for me to add to it real­ly, just read the blog to see how it works.

Dealing with Circular References in WCF

Using enti­ty class­es in your appli­ca­tion and WCF is com­plain­ing about the cir­cu­lar ref­er­ences between your class­es? Well, I had the exact same prob­lem not long ago, and I found this post on James Kovac’s blog about cir­cu­lar ref­er­ences and how to get around them: http://www.jameskovacs.com/blog/GoingAroundInCirclesWithWCF.aspx The key things to note from this post is …

Deal­ing with Cir­cu­lar Ref­er­ences in WCFRead More »

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.