2011-07-14 172 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