This project is read-only.


One of the reasons I have avoided WCF like the plague over the years was due to the ridiculous amount of configuration that was needed. Having the ability to use multiple protocols and endpoints for the same service is really nice, but what if your needs were as simple as “I need to call something over http and get X back”? A scenario would be your typical service created for AJAX calls for some UI. ASMX web services provided a very simple and direct way to do these things without having to manage a bunch of crazy configuration entries.

With WCF 4.0 defaults for protocols, bindings, and behaviors are baked, and there is even a way to do the services without an actual .svc file (File-less Activation). You can get a great overview of these new features on MSDN:

While these are all great improvements, I still want more because I’m lazy and am always trying to find ways to work smarter, not harder, so enter SimpleWcf. SimpleWcf provides a way to essentially do “simple, configuration-less, file-less, WCF”. It works by discovering services using reflection and assumes a convention is used for the namespaces.

Getting started (using the example):

All that is needed to use SimpleWcf is to add a reference to the assembly and make the following two configuration changes (ok so it’s not entirely configuration-less!):


Start the ExampleWcfServiceApplication project by hitting F5 and add Service1.svc to the end of the url like http://localhost:2861/Service1.svc.
Please note your port number may differ


Now enter "list" on the end like http://localhost:2861/list to see a complete listing of the services available:


Note the service created in the ExampleWcfServiceLibrary.SubFolder namespace is now referenced as /SubFolder/Service2.svc. (Namespaces are converted to paths).
Also notice that you have the option to add a description to your service by using a description attribute:


Additional configuration

SimpleWcf can also be additionally configured as follows:


useSvcExtension Services will not have a file extension (such as .svc) (not required)
serviceBasePath Provides a base path for all services (not required)
assemblies Scopes what assemblies should be used to discover services. (not required)

Example of all the settings in action:


Note !

This code is provided as it, it was something that I just wanted to work out on my own, you should thoroughly test it before using it in a production environment.

Last edited Aug 13, 2010 at 4:13 PM by wojan, version 32


No comments yet.