tags:

views:

37

answers:

2

Is it possible to change the endpoint address on a WCF service when using IIS Hosting, I current just point to the svc file but I would like to use RESTful commands?

+2  A: 

Discussed in Overview of REST in WCF. They point to the WCF REST Starter Kit.

The WCF REST Starter Kit is a set of .NET Framework classes and Visual Studio features and templates that enable users to create and access REST-style Windows Communication Foundation (WCF) services. These services are based on the WCF web programming model available in .NET 3.5 SP1. The starter kit also contains the full source code for all features, detailed code samples, and unit tests.

gimel
+1  A: 

WCF in .NET 4 will support so-called file-less activation, which will allow you to define any arbitrary URL, and map that to a WCF service.

Check out the Developer's Introduction to WCF 4 for some info, or read this blog post specifically on file-less activation.

Basically, in WCF 4, you can add an entry to your web.config:

<serviceHostingEnvironment  >
   <serviceActivations>
       <add factory="System.ServiceModel.Activation.ServiceHostFactory" 
            relativeAddress="/Services/MyService" 
            service="MyServiceClass"/>
   </serviceActivations>
 </serviceHostingEnvironment>

and thus, pointing your browser to http://YourServer/Services/MyService would then activate that particular service.

Ron Jacobs also has an interesting approach for REST services, where he registers a route to avoid the *.svc file - he explains this for the WCF Data Services, but it's my feeling, this should work for all WCF REST services, really. But it's a .NET 4 only feature, also.

marc_s