Hosting WCF services in Windows Azure is easy:
- create service contract and implementation,
- add serviceactivation to web.config of the Role you’re hosting the service in.
... <system.serviceModel> <serviceHostingEnvironment multipleSiteBindingsEnabled="true" > <serviceActivations> <add relativeAddress="calculator.svc" service="CalculatorServiceImplementation"/> </serviceActivations> </serviceHostingEnvironment> </system.serviceModel> ...
The serviceactivation needs a registered extension (svc) to be activated. When you want to do this without an extension use the IIS Url Rewrite extension and add the rewrite of the url without the .svc to the web.config. This extension is default available and activated in Windows Azure.
... <system.webServer> <modules runAllManagedModulesForAllRequests="true"/> <rewrite> <rules> <rule name="Calculator Rule" stopProcessing="true"> <!-- Match Calculator on the end of the url --> <match url="Calculator" /> <!-- Redirect to the .svc url where the service will be activated --> <action type="Rewrite" url="Calculator.svc" /> </rule> </rules> </rewrite> </system.webServer> ...
The .svc url is still available and is actually used to activate the service. But that is what the sort of in the title is for 😉