WCF configuration for WebHttpBinding(Restful) for supporting both HTTP and HTTPS
Posted
by KSS
on Stack Overflow
See other posts from Stack Overflow
or by KSS
Published on 2010-06-17T22:27:19Z
Indexed on
2010/06/17
22:33 UTC
Read the original article
Hit count: 1305
We are using AJAX Cascading dropdown and AutoComplete functionality with Restful WebService Services providing data. With one endpoint(non-secured) eveything was working fine, until we tried same web page with https. Our Webappplication needs to support both. Our of very few articiles/blogs on this issue I found 2 which applies to my requirements. 1. http://blog.abstractlabs.net/2009/02/ajax-wcf-services-and-httphttps.html 2. _http://www.mydotnetworld.com/post/2008/10/18/Use-a-WCF-Service-with-HTTP-and-HTTPS-in-C.aspx
I followed same pattern, added 2 endpoints, assuming WCF will pickup appropriate endpoint looking at HTTP or HTTPS protocol. Worked like a charm in my dev machine(XP-IIS5) and 1 Server 2003R2(IIS6), however did work in Production server 2003-IIS6. Website in IIS is exact same(including permission etc). The error it throws - Error 500(Could not find a base address that matches scheme https for the endpoint with binding WebHttpBinding. Registered base address schemes are [http]..)
Here's the sample configuration(ignore typos)
<system.serviceModel>
<bindings>
<webHttpBinding>
<binding name="SecureBinding">
<security mode="Transport"/>
</binding>
</webHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="SearchServiceAspNetAjaxBehavior">
<enableWebScript />
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<services>
<service name="SearchService">
<endpoint address="" behaviorConfiguration="SearchServiceAspNetAjaxBehavior"
binding="webHttpBinding" contract="SearchServiceContract" />
<endpoint address="" behaviorConfiguration="SearchServiceAspNetAjaxBehavior"
binding="webHttpBinding" bindingConfiguration="SecureBinding" contract="SearchServiceContract" />
</service>
</services>
</system.serviceModel>
Any help on this is highly appreciated ?
Thanks KSS
© Stack Overflow or respective owner