2015-09-04 145 views
0
<system.serviceModel> 
<!--WCF Service--> 
<services> 
    <service name="Service.RestServices"> 
    <endpoint address="" 
       binding="basicHttpBinding" 
       bindingConfiguration="secureHttpBinding" 
       contract="Service.IRestServices"/> 

    <endpoint address="mex" 
       binding="mexHttpsBinding" 
       contract="Service.IRestServices" /> 
    </service> 
</services> 
<!--WCF Binding--> 
<bindings> 
    <basicHttpBinding> 
    <binding name="secureHttpBinding"> 
     <security mode="Transport"> 
     <transport clientCredentialType="None"/> 
     </security> 
    </binding> 
    </basicHttpBinding> 
</bindings> 
<!--WCF Behaviors--> 
<behaviors> 
    <serviceBehaviors> 
    <behavior> 
     <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> 
     <serviceMetadata httpsGetEnabled="true"/> 
     <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> 
     <serviceDebug includeExceptionDetailInFaults="false"/> 
    </behavior> 
    </serviceBehaviors> 
</behaviors>  

爲WCF REST服務

SSL實現是有什麼事我想在我的Web.config文件的考慮?以下是我的服務界面。

Service Interface(IRestServices)

[OperationContract] [WebInvoke(ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json, Method = "POST", UriTemplate = "Login", BodyStyle = WebMessageBodyStyle.Wrapped)]

當我嘗試使用HTTPS則迴應,我去打電話是404(未找到),而使用HTTP,我得到的響應數據正常。

如何使用HTTPS調用我的其餘api Web服務(WCF)?

+1

您是否驗證服務有一個HTTPS綁定?可能它設置爲僅對HTTP響應 –

+0

@VolkanPaksoy 如何驗證服務是否具有HTTPS綁定?有沒有任何示例比請建議,謝謝。 – Hrdk

+0

看看您的應用程序池 –

回答

0

我們已經在我們WebService.svc文件中定義的工廠以支持HTTPS的WCF休息服務

<%@ ServiceHost Language="C#" Debug="true" Service="XcellenceIt.Plugin.Misc.NopRestApi.Service.RestServices" Factory="System.ServiceModel.Activation.WebServiceHostFactory" %>