2015-09-04 198 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" %>