Thursday, January 22, 2009

Deploying a WCF Service with IIS 7

I did expect it to be this simple but I could not believe it would really be that way. All it takes for a WCF service to be deployed to IIS box is the following:
  1. Copy .svc file into a web site folder on the server,
  2. Copy .dll file into a \bin subfolder in the web site,
  3. Copy web.config or create a new one. It has to have the endpoint configuration. The one created by default by Visual Studio 2008 simply references "localhost", which seem to be fine.
  4. "%windir%\Microsoft.NET\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe" -r -y
Assuming the service has been tested through Visual Studio 2008 on the development box, this is it!
Navigate the browser to that http://<server>/<service>.svc and you will see the service front page. The step #4 is required for WCF to work IIS OOTB.

This works for the default option of BasicHTTPBinding and no specific endpoint or binding configuration. The point was to get it working. All the nitty-gritty stuff comes later.

No comments: