rickgaribay.net

Space shuttles aren't built for rocket scientists, they're built for astronauts. The goal isn't the ship, its the moon.
posts - 300, comments - 180, trackbacks - 35

My Links

News

Archives

Post Categories

Published Works

WCF IIS Hosting Gotcha

I have been a strong proponent of taking the seperation of interface and implementation all the way down to the IDE. For example, a WCF service just might happen to be hosted in IIS 5/6 today using HTTP, but tomorrow, that service should be able to move, transparently to IIS 7 WAS and be bound to TCP, IPC, MSMQ or any other supported transport protocol.

For this reason, I advocate using class library project templates so that the service can be self-hosted using Windows Services or any other host process and not be intrinsically tied to IIS.

There is one gotcha, however.

When Visual Studio builds a class library project, it uses the default configuration that places the assemblies in the bin/debug folder. IIS doesn't probe the /Debug folder, so you will get the following exception:

 The type 'Services.MyService', provided as the Service attribute value in the ServiceHost directive could not be found.

The solution is to either copy the assemblies from the bin/debug folder to the root of the bin folder, or change your debug settings in Visual Studio to do the same. To do so, go to Properties (right click the project), select the Build tab and change the Output Path from "bin\Debug\" to "bin\".

Note that using the Web Application Project template (available for Visual Studio 2005 with SP1) adheres to this behavior by default, but again, in keeping your services transport/binding agnostic, I recommend using a class library template or better yet, create your own template!

Print | posted on Tuesday, July 10, 2007 6:30 AM | Filed Under [ WCF ]

Comments have been closed on this topic.

Powered by: