purpose of life is joy


How to : remove .SVC extension from WCF service URL

By default, WCF service URL runs with .svc extension. sometimes, I felt that .svc extension is not useful when we reference or share the service URL to application or public. There is a very simple way I found to remove this extension and run as very plain URL with out any major coding. Normally, URL looks like below http://domainname/WCFServiceName.svc/MethodName?parameter We need to change the above URL to below one. Looks simple and neat right? http://domainname/WCFServiceName/MethodName?parameter Simple solution is to implement it at web.config level using URL re-writing which is very very simple. Other methods like writing custom URL Re writing module, configure at server level are little complex than compared to web.config changes.We have to apply changes under system.webserver as below below WCFServiceName names alone we need to change according to your service name. try now with removing with .svc URL. Share your feedback!!! <system.webServer> <modules runAllManagedModulesForAllRequests="true"/> <rewrite> <rules> <rule name="WCFServiceName" stopProcessing="true"> <match url="^WCFServiceName/(.*)$"/> <action type="Rewrite" url="WCFServiceName.svc/{R:1}" /> </rule> </rules> </rewrite> </system.webServer>


REST (40 years old HTTP style)- Unique Identifier.- Uniform interfaces.- Resource- Representation- Stateless
Protected by Copyscape Web Plagiarism Check