Showing posts with label wcf. Show all posts
Showing posts with label wcf. Show all posts

WCF services - Keep your system healthy with automated tests

If you are finally able to "call" your webservice, you may run into the following error message:
image

"The maximum string content length quota (8192) has been exceeded while reading XML data. This quota may be increased by changing the MaxStringContentLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader. Line 501, position 22."

Running into this you may ask yourself these questions

Question from the WCF .NET class - More than 1 endpoint found

I was teaching the UTS .NET class and a student asked me this interesting question…

Question
I am not able to create a new instance of the Countries.SoapClient(). The error that I get is

image

"An endpoint configuration section for contract 'ServiceReference1.countrySoap' could not be loaded because more than one endpoint configuration for that contract was found.
Please indicate the preferred endpoint configuration section by name."

 

Answer

How to unit test a WCF service?

I am *very* keen on automating tests, so I was looking into unit testing a WCF service.

If I say "unit test", I mean a fast, in-memory, independent and automated test of a functional unit-of-work in the system.
Unit of work is at maximum one method (on my projects)
With thanks to Roy Osherove

Why should we unit test a WCF service?

"Real time" communication – client/server

How would you implement an online chat application?
Which technology would you use?

--------

We are building something similar and have the following requirements

  1. People on the web should be able to use it
  2. No download of an application
  3. Broadcasting messages to all user (server to clients)
  4. Everyone should be able to use it
    1. People behind firewalls, proxies, NATs, …
    2. People with 1 of the current browsers
  5. Lightweight solution needed

 

We tested and verified different technology options like:

  • HTML+ Reverse AJAX
  • Silverlight 2: Duplex WCF over HTTP (Long polling HTTP connection under the hood or Comet-style)
  • Silverlight 4: Duplex WCF over TCP (is using net.tcp, socket connection under the hood)
  • Silverlight raw Sockets (maybe even using SocketsLight)
  • Silverlight UDP
  • HTML 5 web sockets

The signs for HTML 5 web sockets are not so good, even though the promise for the socket implementation sounds interesting!
But it seems that HTML 5 is not going to be ready before ~201X, X > 2 and not sure what that X is…
More here
http://blogs.techrepublic.com.com/programming-and-development/?p=718
http://www.webmonkey.com/blog/HTML_5_Won_t_Be_Ready_Until_2022DOT_Yes__2022DOT

 

We finally are using "Silverlight with Duplex WCF over TCP
And falling back to "Silverlight with Duplex WCF over HTTP” when we have a firewall or proxy in the middle that causes connection problems.

The main reason for going in that direction was:

  • Ease of development and productivity in coding with Silverlight and WCF
  • Developing against one API (WCF) and doing an easy fallback behind the scenes (10 lines of code!)
  • Performance is awesome by using TCP (see Tomasz post about that)
  • Testing Silverlight means testing 1 environment against testing different browsers, operating systems, JavaScript versions, OS versions, browser versions,....

 

PS
There is a new HTTP polling duplex mode added in Silverlight 4 RC, called “MultipleMessagesPerPoll”, makes this technology even more interesting

Latest Posts

Popular Posts