debugging WCF? Use the SvcConfigEditor, right from VS!

This isn’t a new ‘trick’ per se, but enough people either don’t know or don’t remember about it, so I’ll make a post 🙂

If you’re doing WCF services of any type (inside IIS or not, WS* or REST or whatever) you likely have an app.config or web.config (or both, depending on how you’re configuring your clients) that holds your system.serviceModel configuration (your WCF config).

The WCF configuration is very powerful and flexible, but as such can be difficult to work with manually. That’s where SvcConfigEditor comes in, helping to at least make it a little more manageable than editing the config xml manually when trying to get your WCF server or client configured.

First, where is it?  You can find it inside the start menu:

image

You can also run it from the VS command prompt (just type ‘svcconfigeditor’).  In both cases, you’re running what’s at this path (for me, on x64 OS)

» dir -r -fi SvcConfigEditor.exe | f
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\SvcConfigEditor.exe
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\SvcConfigEditor.exe

Now, you can certainly just run the exe and point it at the config you want to edit, but VS lets you do ‘Open With’ for files, so we can add SvcConfigEditor there and then be able to do the WCF config editing right from VS.

First, right-click on the config file (web.config or app.config or whatever) that contains your WCF config and choose ‘Open With’:

image

It will default to the XML editor for the config file:

image

However, we want to add a new tool to that list, so we choose ‘add’ and then put in the path to the editor and a friendly name for the list:

image

image

You could click ‘Set as Default’ here, too, but I like keeping the XML editor as the default, so I don’t.

Since the new entry is now selected, we can just click OK and have the config open in the editor:

image

There’s lots of goodness in the config, but the real treat is under Diagnostics where you can turn on lots of different kinds of options around message logging and end-to-end tracing:

image

 

image

Advertisements

One thought on “debugging WCF? Use the SvcConfigEditor, right from VS!

  1. Pingback: making a WCF REST stand-alone service exe from scratch – part 1 of 4, creating the minimal bare service « James Manning's Blog

Comments are closed.