Wednesday, 29 April 2009

Hiding the WCF .svc extension on IIS 5 or 6

If you're setting up a WCF web service, its nicer to present a URL that does not have the .svc extension in it, i.e.

Instead of

A simple way of achieving this on IIS versions 5 or 6 is using the free ISAPI Rewrite tool, with the following configuration:

# Don't rewrite url's that already contain .svc.

RewriteRule .*\.svc.* - [L]

# Rewrite requests for host to be

RewriteCond %{HTTP:Host}

RewriteRule ^/(.*)$ /service.svc/$1 [L]

No comments: