Frustrated that your ServiceRouting code doesn’t work on Azure? Forget deployment..it doesn’t even work on the development fabric??
Thanks to Christian Weyer for pointing us in the right direction.
In order for ServiceRouting to work on Azure, a statement like
RouteTable.Routes.Add(
new ServiceRoute(
"calculate", new WebServiceHostFactory(),
typeof(CalculatorService)));
is not enough… you will also need to add the following sections to your web.config
<configSections>
<sectionGroup name="system.serviceModel"
type="System.ServiceModel.Configuration.ServiceModelSectionGroup, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="standardEndpoints"
type="System.ServiceModel.Configuration.StandardEndpointsSection, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
</sectionGroup>
</configSections>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
and
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
<standardEndpoints>
<webHttpEndpoint>
<standardEndpoint helpEnabled="true"
automaticFormatSelectionEnabled="true">
<security mode="None"/>
</standardEndpoint>
</webHttpEndpoint>
</standardEndpoints>
</system.serviceModel>
so finally your web.config looks something like this
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="system.serviceModel"
type="System.ServiceModel.Configuration.ServiceModelSectionGroup, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="standardEndpoints"
type="System.ServiceModel.Configuration.StandardEndpointsSection, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
</sectionGroup>
</configSections>
<system.web>
<compilation debug="false"
targetFramework="4.0" />
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
<standardEndpoints>
<webHttpEndpoint>
<standardEndpoint helpEnabled="true"
automaticFormatSelectionEnabled="true">
<security mode="None"/>
</standardEndpoint>
</webHttpEndpoint>
</standardEndpoints>
</system.serviceModel>
</configuration>
Hope your urls look nice and pretty now!!
Cennest!!