WebHttpBinding(Restful)的WCF配置,用于支持HTTP和HTTPS

时间:2010-06-17 22:27:19

标签: wcf http rest https webhttpbinding

我们正在使用提供数据的Restful WebService Services的AJAX级联下拉和自动完成功能。有一个端点(非安全)eveything工作正常,直到我们用https尝试相同的网页。我们的Web应用程序需要同时支持。关于这个问题,我们发现了很少的关于这个问题的关于我的要求。

  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
  3. 我遵循相同的模式,添加了2个端点,假设WCF将拾取适当的端点,查看HTTP或HTTPS协议。在我的开发机器(XP-IIS5)和1 Server 2003R2(IIS6)中工作就像一个魅力,但是在生产服务器2003-IIS6中工作。 IIS中的网站完全相同(包括许可等)。 它抛出的错误 - 错误500(无法找到与绑定WebHttpBinding的端点的方案https匹配的基址。注册的基址方案是[http] ..)

    以下是示例配置(忽略拼写错误)

    <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>
    

    对此有何帮助表示高度赞赏?

    由于 KSS

1 个答案:

答案 0 :(得分:0)

我在我的服务中使用的配置几乎相同,但我的端点行为引用了<webHttp />而不是<enableWebScript />。您提到您的服务器是相同的,但无论如何,您是否尝试在受影响的服务器上的其他位置测试SSL流量?