﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>http://ayende.com</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2021 (c) 2026</copyright><ttl>60</ttl><item><title>Paul commented on WCF works in mysterious ways</title><description>You know what's rubbish? 
  
  
DataContractSerializerOperationBehavior is generated for each of your operations. At the time that it gets created it blissfully ignores all 
&lt;datacontractserializer options that have been defined, and uses a hardcoded value of 65535.
  
  
The ONLY way to change this is with code. Kind of hard when your code is already deployed and the customer refuses to accept a new code change.
  
  
WCF is crap. Crap. CRAP.
  
  
Never use the pile of garbage, you'll just waste hours of time on plumbing which should Just Work. 
&gt;</description><link>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment34</link><guid>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment34</guid><pubDate>Thu, 25 Jun 2009 23:22:07 GMT</pubDate></item><item><title>Yaron Naveh commented on WCF works in mysterious ways</title><description>Setting limits to Int32.MaxValue is not always best and can be used in DOS attacks. See here:
  
  
[http://webservices20.blogspot.com/2009/06/are-wcf-defaults-considered-harmful.html](http://webservices20.blogspot.com/2009/06/are-wcf-defaults-considered-harmful.html)</description><link>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment33</link><guid>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment33</guid><pubDate>Sat, 20 Jun 2009 16:33:02 GMT</pubDate></item><item><title>KS commented on WCF works in mysterious ways</title><description>We hit various problem with WCF as well, especially the bandwidth it is taking: as both NetData or DataContractSerializer are in XML, they send extra information that we wants. 
  
  
Looking at ProtoBuffer but I need to define .proto for each entities? Also current Proto.net does not support all C# types right?
  
  
Can I just do ISerializable over WCF? Also can WCF take something like 5000 invocation per operation per second kind-of load? We have huge problem with the bandwidth at that rate.
  
  
Thank you.
</description><link>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment32</link><guid>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment32</guid><pubDate>Mon, 15 Jun 2009 08:35:38 GMT</pubDate></item><item><title>James commented on WCF works in mysterious ways</title><description>Frank,
  
  
Perhaps the solution is easy for you, but pray tell how one is to ascertain that a custom endpoint behavior to set data contract serliazer options is required, when the exception error message states to change the value of another existing option that has no effect?
  
  
WCF is archictecture astronauts gone wild.
</description><link>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment31</link><guid>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment31</guid><pubDate>Sat, 06 Jun 2009 12:32:12 GMT</pubDate></item><item><title>James commented on WCF works in mysterious ways</title><description>Interesting, we ran into this exact problem at work on Friday, and were scratching our heads as well.
  
  
And the prize for the most misleading exception error message goes to....Team WCF!
  
  
In our case, with both endpoints under our control, customers were going WTF, as were we. (Since we send a substantial amount of data back and forth over object graphs, some of them being rather large).
</description><link>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment30</link><guid>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment30</guid><pubDate>Sat, 06 Jun 2009 12:28:51 GMT</pubDate></item><item><title>John Simons commented on WCF works in mysterious ways</title><description>How is this different from enabling 2nd level caching in NHibernate?
  
Thank god(Ayende) that there is NHProf to see under the hood. 
</description><link>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment29</link><guid>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment29</guid><pubDate>Sat, 06 Jun 2009 00:03:53 GMT</pubDate></item><item><title>Frank commented on WCF works in mysterious ways</title><description>Hmmm, for some reason the blog engine doesn't html encode the XML I posted. View the source of this page if you want to view it. ;-)
</description><link>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment28</link><guid>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment28</guid><pubDate>Fri, 05 Jun 2009 18:55:08 GMT</pubDate></item><item><title>Frank commented on WCF works in mysterious ways</title><description>Oh, but the solution is easy. Configure an endpoint behavior for the client that changes the maximum number of items that the data contract serializer allows.
  
  
&lt;behaviors  
&lt;endpointbehaviors  
&lt;behavior  
&lt;datacontractserializer  
&gt;  
  
  
  
It is OK if you wanna go down another part, that is your choice.
</description><link>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment27</link><guid>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment27</guid><pubDate>Fri, 05 Jun 2009 18:53:28 GMT</pubDate></item><item><title>Jeremy Gray commented on WCF works in mysterious ways</title><description>The very fact that this thread got so long and filled with so many little details yet still didn't solve the problem largely proves Ayende's point. There is no reason that he should have to fight that hard to get a large graph through. Sure, there should be limits, and they'll have to be set somewhere, but he did exactly what the exception instructed and it didn't work.
  
  
WCF is extremely flexible and extremely powerful, and with enough effort can be used to do excellent things. However, the "with enough effort" part seems to have been the real problem any time I've worked with WCF. As soon as you need to move beyond the defaults you are off chasing giant piles of XML (or its programmatic alternatives) and/or trying to figure out what combination of the myriad attributes to apply to what types on which side of the wire.
  
  
Given the power that WCF has, these kinds of things will never be dead easy but I should at least be able to spend more of my effort on direct business value and less on using the library. It doesn't seem to take too long to push WCF past a tipping point and end up at "Protocol Buffers &amp; TcpClient, here I comes" or some other alternative.
</description><link>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment26</link><guid>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment26</guid><pubDate>Fri, 05 Jun 2009 17:46:21 GMT</pubDate></item><item><title>Frank commented on WCF works in mysterious ways</title><description>I have to disagree with that. Your scenario is not one of the more common scenarios. While developing I don't have to think about much, only configure a default binding and off you go. As soon, as you are doing stuff, like sending over alot of items and/or alot of data, you will be running into 'problems'. Many of which are present to prevent people from doing stuff like blowing up your service or receiving client by bombarding it with a never ending XML. ;)
</description><link>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment25</link><guid>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment25</guid><pubDate>Fri, 05 Jun 2009 15:50:09 GMT</pubDate></item><item><title>Ayende Rahien commented on WCF works in mysterious ways</title><description>The problem is that it is setup to make you fail, too many things that you have to keep in mind at once, and _way_ too much complexity at _way_ too early stage of the gaem
</description><link>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment24</link><guid>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment24</guid><pubDate>Fri, 05 Jun 2009 14:41:12 GMT</pubDate></item><item><title>Frank commented on WCF works in mysterious ways</title><description>Sorry to hear that, Ayende. In my personal experience, WCF is not brittle, but one does need a deep understanding about how it is envisioned. Alot like many other frameworks that try to tackle a certain problem but are very flexible.
</description><link>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment23</link><guid>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment23</guid><pubDate>Fri, 05 Jun 2009 14:32:58 GMT</pubDate></item><item><title>Arnon Rotem-Gal-Oz commented on WCF works in mysterious ways</title><description>WCF is not that brittle 
  
I think its main problem is that many (if not all) its defaults are dumb, idiotic, fit only for demos or all of the above
  
Arnon
</description><link>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment22</link><guid>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment22</guid><pubDate>Fri, 05 Jun 2009 14:27:39 GMT</pubDate></item><item><title>Ayende Rahien commented on WCF works in mysterious ways</title><description>Krzysztof,
  
Yes, but I already made the decision that I am not going to bother with something that brittle
  
</description><link>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment21</link><guid>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment21</guid><pubDate>Fri, 05 Jun 2009 11:50:59 GMT</pubDate></item><item><title>Ayende Rahien commented on WCF works in mysterious ways</title><description>Marc,
  
I gave up on WCF because it got too complex to actually bother using.
  
Too many things that you have to get just right.
  
I am currently just throwing data over the wire, and so far, it seems to be pretty cool
</description><link>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment20</link><guid>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment20</guid><pubDate>Fri, 05 Jun 2009 11:48:07 GMT</pubDate></item><item><title>Marc Gravell commented on WCF works in mysterious ways</title><description>I should also add - if you are talking full .NET to full .NET, there is also a protobuf-net hook *directly* into WCF - by adding a behaviour (attribute), you can swap the serializer to use protobuf-net. If you are using httpBasic this also uses MTOM for maximum throughput.
</description><link>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment19</link><guid>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment19</guid><pubDate>Fri, 05 Jun 2009 11:09:36 GMT</pubDate></item><item><title>Marc Gravell commented on WCF works in mysterious ways</title><description>Re protocol buffers - it isn't 100% there yet, but there is an in-progress interface-based RPC stack in protobuf-net. I've currently only had time to do the http layer, but this is pluggable, so should support TCP (I just haven't had time).
  
  
Or you could just use any PB implementation (I gather you're using dotnet-protobufs) and throw the data along the pipe yourself...
</description><link>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment18</link><guid>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment18</guid><pubDate>Fri, 05 Jun 2009 10:59:32 GMT</pubDate></item><item><title>Juanma commented on WCF works in mysterious ways</title><description>Protobuf + TcpClient is the way to go. 
  
  
We migrated a project from WCF to Protobuf + TcpClient in less than a day and got a big performance improvement.
</description><link>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment17</link><guid>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment17</guid><pubDate>Fri, 05 Jun 2009 09:53:14 GMT</pubDate></item><item><title>Krzysztof Kozmic commented on WCF works in mysterious ways</title><description>Ayende
  
  
Did Arnon' suggestion (DataContractSerializerOperationBehavior) fix it for you?
</description><link>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment16</link><guid>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment16</guid><pubDate>Fri, 05 Jun 2009 09:23:56 GMT</pubDate></item><item><title>Huseyin Tufekcilerli commented on WCF works in mysterious ways</title><description>Alternatively, you can attribute your service contract operations with the following NetDataContractFormat attribute and force them to use NetDataContractSerializer instead of DataContractSerializer:
  
  
[www.pluralsight.com/.../22284.aspx](http://www.pluralsight.com/community/blogs/aaron/archive/2006/04/21/22284.aspx)</description><link>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment15</link><guid>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment15</guid><pubDate>Thu, 04 Jun 2009 18:55:59 GMT</pubDate></item><item><title>Rafal commented on WCF works in mysterious ways</title><description>Maybe you should set
  
WCF.IAmSorryForNotHavingAPhD = true
  
then it will just work
</description><link>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment14</link><guid>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment14</guid><pubDate>Thu, 04 Jun 2009 18:28:17 GMT</pubDate></item><item><title>Arnon Rotem-Gal-Oz commented on WCF works in mysterious ways</title><description>Ok, Now I actually ran your code - so I see the problem :)
  
You also need to set the MaxItemsOnInfoGraph on the client side 
  
so before you CreateChannel  on the factory you need to do something like
  
            var channelFactory =
  
                new ChannelFactory
&lt;idistributedhashtablemaster(binding, new EndpointAddress(uri));
  
  
            foreach (var operationDescription in channelFactory.Endpoint.Contract.Operations)
  
            {
  
  
                var dataContractBehavior =
  
  
                operationDescription.Behaviors[typeof(DataContractSerializerOperationBehavior)]
  
  
                as DataContractSerializerOperationBehavior;
  
  
                if (dataContractBehavior != null)
  
                {
  
  
                    dataContractBehavior.MaxItemsInObjectGraph = int.MaxValue;
  
  
                }
  
  
            }
  
            var channel=channelFactory.CreateChannel();
  
            channel.Join();
&gt;</description><link>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment13</link><guid>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment13</guid><pubDate>Thu, 04 Jun 2009 18:17:53 GMT</pubDate></item><item><title>Stephen commented on WCF works in mysterious ways</title><description>I'm pretty sure the data contract serializer has a limit on it as well, you'll need to specify that (probably as a service behavior).
</description><link>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment12</link><guid>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment12</guid><pubDate>Thu, 04 Jun 2009 17:55:40 GMT</pubDate></item><item><title>Krzysztof Kozmic commented on WCF works in mysterious ways</title><description>Try also creating DataContractSerializer and serializing the object graph yourself. If it succeeds then it's a misleading message and the problem lies somewhere else,
</description><link>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment11</link><guid>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment11</guid><pubDate>Thu, 04 Jun 2009 17:51:36 GMT</pubDate></item><item><title>Jesse Ezell commented on WCF works in mysterious ways</title><description>The service behavior attribute only applies to the server side. You need to set it on the ClientSide in the endpointbehaviors config or programmatically or you will hit the limit trying to serialize your object graph.
</description><link>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment10</link><guid>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment10</guid><pubDate>Thu, 04 Jun 2009 17:49:27 GMT</pubDate></item><item><title>Ayende Rahien commented on WCF works in mysterious ways</title><description>Not working either :-(
  
And NodeEndpoint have those
</description><link>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment9</link><guid>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment9</guid><pubDate>Thu, 04 Jun 2009 17:41:25 GMT</pubDate></item><item><title>Arnon Rotem-Gal-Oz commented on WCF works in mysterious ways</title><description>Sorry that should be ServiceKnownType not KnownType  
  
NodeEndPoint should also have the [datacontract] and [DataMember] attributes
</description><link>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment8</link><guid>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment8</guid><pubDate>Thu, 04 Jun 2009 17:39:46 GMT</pubDate></item><item><title>Ayende Rahien commented on WCF works in mysterious ways</title><description>With or without it, it doesn't work
</description><link>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment7</link><guid>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment7</guid><pubDate>Thu, 04 Jun 2009 17:38:37 GMT</pubDate></item><item><title>Arnon Rotem-Gal-Oz commented on WCF works in mysterious ways</title><description>you probably don't 
</description><link>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment6</link><guid>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment6</guid><pubDate>Thu, 04 Jun 2009 17:34:27 GMT</pubDate></item><item><title>Ayende Rahien commented on WCF works in mysterious ways</title><description>Arnon,
  
Nope, I tried that, it doesn't work.
</description><link>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment5</link><guid>http://ayende.com/4047/wcf-works-in-mysterious-ways#comment5</guid><pubDate>Thu, 04 Jun 2009 17:33:08 GMT</pubDate></item></channel></rss>