Beringer Associates Technology Blog

WCF webservice doesn’t respond via HTTPS when hosted in Microsoft Azure

Posted by on in Information Technology, IT Outsourcing

What is a Webservice?  According to the World Wide Web Consortium (W3C), a Web service is a software system designed to support interoperable machine-to-machine interaction over a network.  http://www.w3.org/TR/ws-gloss/   This provides a structure for developers to transfer data across the world, and not have to worry about what type of computer is sending or receiving the data.

 

I was recently tasked with building and deploying a Webservice for one of our clients, which would integrate their company website with their Microsoft Dynamics CRM system.  The goal was to capture new information filled in from their Contact Us page, then automatically create a new CRM Lead.  This type of request is very common because end users would rather work with the Lead in their CRM system, where they can capture history and build automation around this data.   This task seemed simple enough, so I built a WCF Webservice, deployed it to Azure and successfully tested the functionality via HTTP.  The client had some security concerns, so I added the SSL certificate and properly configured the endpoints in Azure.  When I published the site and tested it via HTTPS, I ran into this error:
There was no channel actively listening at https://rd00155d411b06/myWebService/helloWorld.svc. This is often caused by an incorrect address URI. Ensure that the address to which the message is sent matches an address on which a service is listening.

 

The Webservice was accessible via the fully qualified domain name: https://myAzure.cloudapp.net/, so why would it expect a response via the machine name https://rd00155d411b06/?
If you are running into this issue, then try my solution.  I needed to specify the security mode in the webHttpBinding tag, and HTTPS worked!  Check out my web.config below, and let me know if this helps you too.
Happy coding everyone 🙂

 

Web.Config
<?xml version=”1.0″?>
<configuration>
<system.web>
<compilation debug=”true” targetFramework=”4.0″ />
</system.web>
<system.serviceModel>
<bindings>
<webHttpBinding>
<binding name=”HttpsConfiguration“>
<security mode=”Transport” />
</binding>
</webHttpBinding>
</bindings>
<services>
<service behaviorConfiguration=”Service1Behavior” name=”WcfService1.Beringer.BERWeb”>
<endpoint address=”” behaviorConfiguration=”JSONEndpointBehavior” binding=”webHttpBinding” bindingConfiguration=”HttpsConfiguration” name=”RESTEP” contract=”WcfService1.Beringer.IBERWeb” />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name=”Service1Behavior”>
<serviceMetadata httpGetEnabled=”true”
httpsGetEnabled=”true”/>
<serviceDebug includeExceptionDetailInFaults=”false”/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name=”JSONEndpointBehavior”>
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled=”true” />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests=”true”/>
<directoryBrowse enabled=”true”/>
</system.webServer>
</configuration>

 

Beringer Associates is a Microsoft Gold Certified Partner providing services in Microsoft Dynamics CRM and CRM for Distribution, managed IT services, cloud based computing and unified communication systems.

Share