2011-07-14 128 views
0

system.service/behaviours/servicebehavioursHTTP和HTTPS请求,以WCF服务

我有以下行为:

<behavior name="pubajaxAspNetAjaxBehavior"> 
    <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" /> 
    <serviceDebug includeExceptionDetailInFaults="true" /> 
</behavior> 

有了这两个属性httpGetEnabled = “true” 和httpsGetEnabled = “真” 的地方就意味着任何请求通过HTTP我的web服务现在抛出错误:

Could not find a base address that matches scheme https for the endpoint with binding WebHttpBinding. Registered base address schemes are [http].

是否有可能有一个WCF服务接受http和https请求?

回答

2

我不认为你可以让它们在同一端点上都是真的,但是你可以为不同的端点使用不同的绑定。

您可以使用绑定为

<bindings> 
     <basicHttpBinding> 
     <binding name="HttpBinding"> 
      <security mode="None"> 
      <transport clientCredentialType="None"></transport> 
      </security> 
     </binding> 
     <binding name="HttpsBinding"> 
      <security mode="Transport"> 
       <transport clientCredentialType="Windows" /> 
      </security> 
     </binding> 
     </basicHttpBinding> 
    </bindings> 

请看看那个帖子

Stackoverflow post