WCF Recruits

Here are some take-aways from my first day attempts at WCF(Windows Communication Foundation). Note: All of it tried on WinFx Beta2 release. WinFx is now known as .NET Framework 3.0

1) The config file (app.config or web.config) for your host (app or IIS respectively) should have the name and contract attributes like:

name="<namespace>.<service type class>"

contract="<namespace>.<service contract interface>"

Incorrect values for the above will cause an InvalidOperationException to be thrown when you 'Open()' the ServiceHost and the message shown is:

Service 'DerivativesCalculatorService.DerivativesCalculatorServiceType' has zero application (non-infrastructure) endpoints.  This might be because no configuration file was found for your application, or because no service element matching the service name could be found in the configuration file, or because no endpoints were defined in the service element.

2) When you host your service in IIS, make sure that the virtual directory that has your service (i.e. the Local Path) has read permissions for the ASPNET user. Also make sure that the output of your service project is to the bin folder and not the default bin\Debug folder. This enables IIS to pick up the assembly of your service.

If the directory does not have read permissions for ASPNET user, you will typically get the "Server Application Unavailable" error page when you try navigating to the "Services.svc" file in the service's virtual directory, through your browser.

3) The service.svc file for your service (when it is hosted in IIS) should contain one line which looks like this:

<%@ ServiceHost Service="<namespace>.<service type class>" %>