WCF 4.0 REST tip: File-less activation
With WCF 3.5, it was always a problem that the service URL’s of REST applications were ending with “.svc”. This was not very RESTfull. One of the new features in WCF 4.0 is the ability to register services for use in IIS without having to rely on “.svc” files. The syntax to configure this is simple:
<configuration> <system.serviceModel> <serviceHostingEnvironment> <serviceActivations> <add relativeAddress="Hello" service="MyNameSpace.HelloService" factory="MyNameSpace.MyServiceHostFactory"/> </serviceActivations> </serviceHostingEnvironment> </system.serviceModel> </configuration>
The following configuration would allow IIS to host the service using the URL:
The factory attribute is optional; it allows you to specify a ServiceHostFactory for your service.