开发者

WCF configuration for WebHttpBinding(Restful) for supporting both HTTP and HTTPS

开发者 https://www.devze.com 2023-01-03 17:09 出处:网络
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

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 issu开发者_运维问答e 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


I'm using almost the same configuration in my service, though my endpoint behavior references <webHttp /> instead of <enableWebScript />. You mentioned your servers are the same, but in any case, have you tried testing SSL traffic elsewhere on the affected server?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号