Saturday, May 22, 2010

Setting up RESTful services in Windows XP

If you chance you haven't upgraded or your company still requires XP usage and skipped Vista and is waiting on Windows 7 - you may need to get WCF and RESTful services working together. **Really this applies to any dynamic routing required - it could be pure WCF as well and anything that uses a RouteTable class such as

RouteTable.Routes.Add(new ServiceRoute("YourFriendlyURLPortion", new WebServiceHostFactory(), typeof(CustomerSearch)));


Once you have your project you will need to do the following:
1. Configure IIS to use .net 4 - go into the properties of your virtual directory and then the ASP.Net tab.




2. Setup a global mapping so ALL files get routed to ASP.Net
Right Click on the virtual directory, go to properties, and then to the Virtual Directory tab. Then click on the Configuration button. You will need to map ALL files to your .net 4 isapi dll. Since IIS 5.1 does not have integrated pipeline for .net, ASP.Net sits on top of IIS via an isapi extension.
Select "All Verbs" (or whatever ones you require if you are limiting to say.. only GET/PUT although that violates RESTful design if you also need delete and update operations which require DELETE and PUT verbs)

I have my isapi dll set to:
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll
In the following image you will see the setup. You must specify .* for the extension (not *.*) otherwise your "OK" button will never enable.






Reset IIS then attempt to go to your service url/help and see if you get the nice new RESTFUL service web page.

1 comment:

  1. BlueHost is the best hosting provider with plans for any hosting requirements.

    ReplyDelete