2017-01-26 68 views
0

我有兩天的時間試圖解決WCF的問題,這些問題在綁定是HTTP時可以工作。但是,一旦我購買了SSL證書,並將我的網站配置爲使用HTTPS,當我更改IIS上的綁定時,我的應用程序就不可用。我如何使用帶有SSL證書的WCF HTTPS IIS

我得到了以下錯誤消息: Could not find a base address that matches scheme http for the endpoint with binding WebHttpBinding. Registered base address schemes are [https].

我的web.config

<services> 
    <service behaviorConfiguration="WebServiceBehavior" name="WcfService1.Service"> 
    <endpoint address="" behaviorConfiguration="jsonBehavior" binding="webHttpBinding" 
       bindingConfiguration="webHttpBindingWithJsonP" contract="WcfService1.IService"/> 
    <endpoint address="soap" binding="basicHttpBinding" contract="WcfService1.IService" /> 
    </service> 
</services> 

<behaviors> 
    <endpointBehaviors> 
    <behavior name="jsonBehavior"> 
     <webHttp helpEnabled="true"/> 
    </behavior> 
    </endpointBehaviors> 

    <serviceBehaviors> 
    <behavior name="WebServiceBehavior"> 
     <serviceMetadata httpGetEnabled="true"/> 
     <serviceDebug includeExceptionDetailInFaults="true"/> 
    </behavior> 
    </serviceBehaviors> 
</behaviors> 

<bindings> 
    <webHttpBinding> 
    <binding name="webHttpBindingWithJsonP" 
      crossDomainScriptAccessEnabled="true" /> 

    </webHttpBinding> 

</bindings> 

它可以讓我的WCF使用HTTPS的工作?

回答

0

這是否有幫助https://msdn.microsoft.com/en-us/library/hh556232(v=vs.110).aspx?它包含一個完整的https配置示例。

我特別想你所需要的security mode=Transport的SSL工作:

<binding name="webHttpBindingWithJsonP" crossDomainScriptAccessEnabled="true"> 
    <security mode="Transport"> 
     <transport clientCredentialType="None"/> 
    </security> 
</binding> 
0

克里斯˚F卡羅爾

感謝您抽出時間來回答我的帖子。

最後,我可以自己修復它。

這裏是我做的,以獲得關於HTTPS和HTTP工作: < serviceHostingEnvironment multipleSiteBindingEnabled="true" aspNetCompatibilityEnabled="false" />

上面的代碼放在裏面:

<system.serviceModel>