I have a WCF on a windows Server 2008 R2. I have a SSL certificate.
With IE, the http URL working fine (I get my data) but with Https I have a 400 Bad Request.
below the web.config for my wcf:
<?xml version="1.0" encoding="utf-8"?>
<bindings>
<basicHttpBinding>
<binding name="TransportSecurity">
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="ServiceRequestResourcesAspNetAjaxBehavior">
<webHttp defaultOutgoingResponseFormat="Json" />
</behavior>
<behavior name="ServiceRequestResourcesAspNetAjaxBehaviorHttps">
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="ServiceRequestResourcesBehaviors">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="ServiceRequestResourcesBehaviors"
name="BaseSite.ServiceRequestResources">
<endpoint address=""
behaviorConfiguration="ServiceRequestResourcesAspNetAjaxBehaviorHttps"
binding="basicHttpBinding"
bindingConfiguration="TransportSecurity"
contract="BaseSite.ServiceRequestResources" />
<endpoint address=""
behaviorConfiguration="ServiceRequestResourcesAspNetAjaxBehavior"
binding="webHttpBinding" contract="BaseSite.ServiceRequestResources" />
</service>
</services>
After a lot of test, it's working. I need to configure the bindings section in webHttpBinding
rather than basicHttpBinding
, but I don't know why.
Below my bindings section:
<bindings>
<webHttpBinding>
<binding name="TransportSecurity">
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
</binding>
</webHttpBinding>
</bindings>
For your section, have you tried adding an endpoint for HTTPS, like this:
<services>
<service behaviorConfiguration="ServiceRequestResourcesBehaviors"
name="BaseSite.ServiceRequestResources">
<endpoint address=""
behaviorConfiguration="ServiceRequestResourcesAspNetAjaxBehaviorHttps"
binding="basicHttpBinding"
bindingConfiguration="TransportSecurity"
contract="BaseSite.ServiceRequestResources" />
<endpoint address=""
behaviorConfiguration="ServiceRequestResourcesAspNetAjaxBehavior"
binding="webHttpBinding" contract="BaseSite.ServiceRequestResources" />
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
</service>
</services>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.