Making your WCF service as RESTful is pretty simple in DOTNET. You have three options Get,Post and Put. To this you have to label your contract with an attribute something like below.

[WebGet(UriTemplate = "/StartProcessing")]
[WebInvoke(Method = "POST", UriTemplate = "/SyncCustomerDetails", BodyStyle = WebMessageBodyStyle.WrappedRequest)]

When i was working on my local development environment which had IIS 7.5 everything went fine and i was able to access the REST based services.
The problem started when i wanted to deploy this to our Development lab which has IIS 5. After it was deployed i could not even access the WCF Rest Help page, this can be accessed by appending a /help after your SVC file in the browser.

The error returned was something Like Http 403 error saying bad request and clicking on the help link below would also throw this error. Searching on the internet did not provide with much help.

Only one link that i found mentioned that this problem is with IIS 5 and that it does not allow accessing URL that are extension-less. To solve this some websites said to allow the '*' as a rule, strange this is that IIS 5 will not allow you to even put in such a parameter.

Next suggestion i tried was to add the '*' in the wild card application map extension for the website / virtual directory. To do this, i had to right click the website -> properties -> Virtual Directory Tab -> click on configuration.
In the application configuration tab that comes up, press the insert button and map to aspnet_isapi dll and remove the "Verify this file" exists.

Sad to say even this option did not work out.

The thing that worked for me was this.

My site is configured to run on AspNet 4.0, and the problem was that the Application Pool was configured to run on AspNet 4.0 but the account under which it runs did not have access to C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files.
The error that was returned also did not provide any help to this because there were no errors in IIS logs, no errors in event viewer, so it really side tracked this.

I hope someone out there finds this useful and can save some time by trying these steps.

Add a comment