“Add Service Reference”: When WCF Metadata Goes Wrong

January 20, 2014

I was helping a student debug a WCF service the other day and stumbled upon a very annoying problem. Visual Studio refused to add a service reference to his service, no matter what we tried. After spending a few minutes copy-pasting configuration snippets from Stack Overflow, I decided to proceed more methodically and see what we're doing wrong. Here's the error we were getting, courtesy of the Visual Studio "Add Service Reference" dialog: At first, I was under the impression that something is wrong with the metadata endpoint itself. Perhaps I used the wrong spelling of IMetadataExchange? Or maybe I don't...
tags: ,
one comment

Hosting a .NET DLL as an Out-Of-Process COM Server (EXE)

January 7, 2014

I recently came across the need of hosting a .NET assembly (DLL) as an out-of-process COM server. While .NET ships with excellent support for COM interoperability, this particular scenario isn't directly addressed by the interop layer. While there are some fairly complex solutions such as COM+ hosting or custom class factory registration, I would like to show you how to accomplish this task using dllhost.exe, the default COM surrogate process, with just a handful of registry modifications. Why? The reason I was looking into doing this is quite simple. Suppose you have a 32-bit only unmanaged DLL that you can't recompile...
tags: , ,