Archive for the ‘WCF’ Category

Microsoft cannot decode Base64: News at 11!

05:28 PM

Arthur has found a really nasty bug in Microsoft’s streaming Base64 decoder as used in the WCF: Connect Bug#541494

In short: If WCF receives a message whose length is not 16+n*3 bytes (int n>=0) AND the receiver tries to read the last byte with Stream.ReadByte or Stream.ReadBoolean, a System.IO.EndOfStreamException “Unable to read beyond the end of the stream.” is thrown from the bowels of WCF. Looking at the source, Reflector’s output, and the strange length restriction, we presume that the Base64 decode tries to read beyond the underlying stream when the last byte is requested.

As an easy workaround we now pad the end of the stream with a few additional bytes which we never read. This way we do not trigger this bug.

Since MS Connect doesn’t allow downloading the Demo Project, here is a local copy.

HTTP could not register URL http://+:666/ – Yeah!

07:16 PM

If you want to run a WCF Server with HTTP Bindings, you’ll have to register it at your OS first. Here is how:

http://blogs.msdn.com/amitlale/archive/2007/01/29/addressaccessdeniedexception-cause-and-solution.aspx

netsh http add urlacl url=http://+:666/ user=DOMAIN\UserName