Configure the HTTP binding in WCF Webconfig and set it to use transport security as follows
1 <bindings>2 <basichttp Binding>3 <binding name= " securehttpbinding >4 <s ecurity mode= " >5 <transport clientcredentialtype= " none " />6 </security>7 </binding>8 </basichttpbinding>9 </bindings>
Specifying service and service endpoints
1<services>2<service name="WCF. Service">3<endpoint contract="WCF. IService"address=""binding="BasicHttpBinding"bindingconfiguration="securehttpbinding"></endpoint>4<endpoint address="Mex"binding="mexhttpsbinding"contract="IMetadataExchange"/><!--here to fix it--5</service>6</services>
The complete webconfig is as follows:
1<?xml version="1.0"encoding="Utf-8"?>2<configuration>3 4<system.web>5<compilation targetframework="4.0"/>6</system.web>7<system.serviceModel>8 9<bindings>Ten<basicHttpBinding> One<binding name="securehttpbinding"> A<security mode="Transport"> -<transport clientcredentialtype="None"/> -</security> the</binding> -</basicHttpBinding> -</bindings> - +<services> -<service name="WCF. Service"> +<endpoint contract="WCF. IService"address=""binding="BasicHttpBinding"bindingconfiguration="securehttpbinding"></endpoint> A<endpoint address="Mex"binding="mexhttpsbinding"contract="IMetadataExchange"/><!--here to fix it-- at</service> -</services> - -<behaviors> -<serviceBehaviors> -<behavior> in<!--to avoid leaking metadata information, set the following values before deployment tofalse- -<servicemetadata httpsgetenabled="true"/> to<!--to receive the fault exception details for debugging, set the following values totrue。 Before deployment, set tofalseTo avoid leaking exception information-- +<servicedebug includeexceptiondetailinfaults="false"/> -</behavior> the</serviceBehaviors> *</behaviors> $ Panax Notoginseng<servicehostingenvironment multiplesitebindingsenabled="true"/> -</system.serviceModel> the<system.webServer> +<modules runallmanagedmodulesforallrequests="true"/> A<!-- the to browse the Web application root directory during debugging, set the following value to True. + Setting this value to False prior to deployment avoids revealing WEB application folder information. -- $<directorybrowse enabled="true"/> $</system.webServer> - -</configuration>
WCF configuration under IIS using SSL (CSDN Manual migration)