Here’s the web config for a WCF web service. I struggled getting it to work under HTTPS. But when all done and working it’s not terrible – I’ll try to highlight the relevant names because that was my primary struggle point. I won’t go into explaining everything, there are tons of posts out there can (and do) explain much better than I can or want to here.
I pieced together several different examples in an attempt to get this working and at first my highlighted names didn’t match – and no luck working. So here are the highlighted sections of the serviceModel element with the names matching up.
See ServiceBehaviorA, wsHttpBinding, and TransportSecurity. These are referenced in the endpoint and must also be referenced in the behaviors and bindings elements.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | <system.serviceModel> <services> <service name="S2C.API.Service" <!-- SEE BELOW in serviceBehaviors --> behaviorConfiguration="ServiceBehaviorA"> <endpoint address="" <!-- SEE BELOW in bindings --> binding="wsHttpBinding" <!-- SEE BELOW the binding name --> bindingConfiguration="TransportSecurity" contract="S2C.API.IService" /> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> </service> </services> <behaviors> <serviceBehaviors> <behavior name="ServiceBehaviorA"> <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> <serviceMetadata httpGetEnabled="true" 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="true"/> </behavior> </serviceBehaviors> </behaviors> <bindings> <wsHttpBinding> <binding name="TransportSecurity"> <security mode="Transport"> <transport clientCredentialType="None"/> </security> </binding> </wsHttpBinding> </bindings> <serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> </system.serviceModel> |